Community Patterns

Community Library Entry

1

Regular Expression
Created·2024-10-08 14:05
Flavor·PCRE2 (PHP)

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

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