Regular Expressions 101

Community Patterns

Get email info

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