The Official Regex Search for Email Addresses
top of page

The Official Regex Search for Email Addresses


RFC 5322 (request for comments) is a standard for internet message formats established by Qualcomm. See the Tip of the Night for November 28, 2015. The site of the developers of PowerGrep discusses an official regular expression search for any email addresses which can comply with the RFC 5322 format, which is also referenced here, and copied here:

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

This regular expression is designed to find any email address that is permitted under the RFC 5322 protocol. I tested it tonight using NotePad++ and it seems to work well.

Note this Regex does not account for protocols which enforce a limit on the number of characters in an email address.


bottom of page