Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
[-_a-zA-Z.+!%0-9]{2,}@[a-zA-Z0-9]{2,}\.[a-zA-Z.]{2,}
/
gm

Description

This piece of regex is a simple format verification for email addresses. It accepts only most common email addresses and it favors simplicity over exhaustivity, but should work for 99% of the cases. Based on this Stackoverflow thread : https://stackoverflow.com/a/60137352/14705619

Submitted by rnorm - 2 years ago