Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^"{0,1}[A-Z0-9_]{1}([A-Z0-9_%+-]+\.{0,1})*[A-Z0-9_]{1}"{0,1}@([A-Z0-9]([A-Z0-9-]+\.)+[A-Z]{2,8}|\[{0,1}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\]{0,1})$
/
gi

Description

not perfect but better than anything I could find.

Submitted by anonymous - 7 years ago