REPORT ZSAPN_VALIDATE_EMAIL. PARAMETERS P_EMAIL TYPE STRING. DATA:GO_REGEX TYPE REF TO CL_ABAP_REGEX, GO_MATCHER TYPE REF TO CL_ABAP_MATCHER. DATA: L_PAT(500) TYPE C. L_PAT = '^[_a-zA-Z0-9-] (\.[_a-zA-Z0-9-] )
*@[a-zA-Z0-9-] (\.[a-zA-Z0-9-] )*(\.[a-zA-Z]{2,4})$' . CREATE OBJECT GO_REGEX EXPORTING PATTERN = L_PAT IGNORE_CASE = ABAP_TRUE.
TRANSLATE P_EMAIL TO LOWER CASE.
GO_MATCHER = GO_REGEX->CREATE_MATCHER( TEXT = P_EMAIL )."lt_node_op4 ). IF GO_MATCHER->MATCH( ) IS INITIAL. WRITE:/ 'Email hatalı'. ELSE. WRITE :/ 'Email doğru'. ENDIF.
Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com
Social Plugin