Email Address Regular Expression That 99.99% Works. Disagree? Join discussion!

Just copy and paste the email regex below for the language of your choice. Feeling hardcore (or crazy, you decide)? Read the official RFC 5322, or you can check out this Email Validation Summary. Note there is no perfect email regex, hence the 99.99%.

General Email Regex (RFC 5322 Official Standard)

Railroad Diagram of Above Regex (click to enlarge)

Free email address validator (with DNS lookup):


Try our FREE Email Form-Builder (with FREE email validation)

Regular Expression:

/ /

Test Strings:

Python

Javascript

HTML5

In case you ever wonder, below is the regex used in type=”email” from W3C:

Swift (Regex only)

Swift (Regex used in a function)

PHP

Perl / Ruby

Perl 5.10 or newer

Java

Ruby (simple version)

.NET (general pattern match)

C#

Another way is to use the System.Net.Mail.MailAddress class. To determine whether an email address is valid, pass the email address to the MailAddress.MailAddress(String) class constructor.

VB.NET

Find All Email Addresses in a File using Grep

SQL Server Email Validation

Oracle PL/SQL Email Regex

MySQL


Bonus: What does the following regex do?