Regular Expressions 101

Community Patterns

Email Validation

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^[A-z0-9]+@[a-z]+\.[a-z]+$
/
gm

Description

Writes a regular expression that performs simple email validation An email consists of: username @ domain name Usernames are alphanumeric Domain names consist of two strings, separated by a period Domain names may contain only English letters

^ means that the pattern should start at the beginning of the row $ means that the pattern should end at the end of the row

Submitted by anonymous - 3 years ago