Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PCRE regular expression to validate that semi-colons have separated a string of emails

Above
Explorer
0 Kudos
261


Hello Experts,

Please help me with the PCRE regular expression to validate that semi-colons have separated a string of emails.

Thank you!

1 REPLY 1
Read only

Above
Explorer
0 Kudos
170

Hi Experts, 

Thanks for your consideration. I'm happy I found a solution to my question. I will share the findings with a practical example. 

Datalv_email_str type string,
      lv_regex type string.
lv_email_str `johndoe@gmail.com; kimteddy@yahoo.com; maria_stella@outlook.com`.
lv_regex `(?!.*;$)^([-\w]+?@\w+\.\w+(?:\s*;\s*)?)+$`.

IF matchesval lv_email_str pcre lv_regex ).
****True****
ELSE.
****False****
ENDIF.

Note: The only special character allowed here besides @, is the semi-colon and only as a separator between emails.

Hi Experts, Thank you for your consideration. I’m pleased to have found a solution to my question. I will share my findings with a practical example.