E-posta adresi doğrulama

cl_abap_matcher ile eposta geçerlilik kontrolü

form f_FULL_Email_regex using PRM_EMAIL
                     changing chn_err type c.

  data: lv_local type string.
  data: lv_pattern  type string.
  CLEAR chn_err.

   lv_pattern  = `^[a-zA-Z]+(([``,.- ][a-zA-Z ])?[a-zA-Z]*)*s+<` &
                  `(w[-._w]*w@w[-._w]*w.w{2,3})>$|^(w[-._w]*` &
                  `w@w[-._w]*w.w{2,3})$`.


  perform f_regex using lv_pattern  PRM_EMAIL changing chn_err .


endform.                    


form f_regex using prm_pattern
                   prm_str changing chn_err type c.
  data: lr_matcher type ref to cl_abap_matcher.
  data: lv_pattern type string.
  data: lv_str type string.
  data: lv_success type char1. "abap_pool. " ABAP_FALSE/TRUE

 lv_pattern = prm_pattern  .
 lv_str = prm_str  .

    try.
        lr_matcher = cl_abap_matcher=>create(
              pattern       = lv_pattern
              text          = lv_str    ).

        call method lr_matcher->match
          receiving
            success = lv_success.
        if lv_success is initial.
          chn_err = `X`.
          return.
        endif.
      catch cx_sy_regex.
        chn_err = `X`.
        return.
      catch cx_sy_matcher .
        chn_err = `X`.
        return.

    endtry.
endform.