Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?(DEFINE) (?'loc_part' [\w!#$%&'*+\-\/=?^`{|}~]+ ) (?'loc' \g'loc_part' (?: \. \g'loc_part' )* ) (?'subdom' [a-z] (?: [a-z\d-]* [a-z\d] )? ) (?'tld' [a-z]{2,6} ) ) (?'local' \g'loc' ) @ (?'domain' (?: \g'subdom' \. )+ \g'tld' )
/
ixg

Description

match some emails and extract their local part and domain

Submitted by dang duomg 191 - 6 months ago (Last modified 6 months ago)