Regular Expressions 101

Community Patterns

Simple email splitter

1

Regular Expression
PCRE (PHP <7.3)

/
^(?'User'[_a-z0-9-]+(\.[_a-z0-9-]+)*)@(?'Domain'[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,4})$
/
i

Description

Split the email and get the user and domain.

Submitted by Matías Pizarro González - 9 years ago