Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
PCRE (PHP <7.3)

/
^(?<User>[_a-z0-9-]+(\.[_a-z0-9-]+(?<GmailTag>\+[_a-z0-9-]+){1,1})*)@(?<Host>[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,4})$
/
i

Description

Get Gmail tag, user and domain of an email address

Submitted by Matías Pizarro González - 9 years ago