Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^(?P<email>(?P<local>(?![\.\ ]+)(?=[^@]+)(?:(?:(?:[\#\!\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~\p{L}\p{N}])*(?:(?<=\.|^)(?:\"(?:[^\"]|(?<=\\)[\"\(\)\,\:\;\<\>\@\[\\\]])*\")\.?)*(?:[\#\!\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~\p{L}\p{N}])*)))(?<!\.)\@(?P<host>(?:[\w\-]+?\.?)*|\[[\w\d\:]*\])(?![\.\ ]+))$
/
gm

Description

Email validation according to RFC standards

Submitted by Colton T. - 8 years ago