Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^((?!\.)[\w\d](?!.*\.\.)[a-zA-Z0-9\.!#$%&'*+\-\/=?^_`{|}~]*[^\.\s])@([a-zA-Z][a-zA-Z\d-]+[a-zA-Z\d]+\.)+[a-zA-Z]{2,6}$
/
gm

Description

Verify that a given e-mail address is valid.

We all know how complex emails are, but despite this, let's give it a try and see what we can come up with.

You could start by trying to match contact@regex101.com (denoted as <local-part>@<domain>.<top-level-domain>).

Submitted by anonymous - 3 months ago