Regular Expressions 101

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,})(;[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,})*;?$
/
i

Description

Validates a single email or a semi-colon list of email addresses. Tolerates leading spaces for the second and later emails.

For example - the following are valid:

Submitted by anonymous - 5 years ago