Search code examples
regexlanguage-agnosticemail-validation

What would be a globally accepted regular expression to match e-mail addresses


I have seen many examples, with many 'no, you missed something' comments. What is the right way to match an e-mail address?

For Sanity sake, only fully-qualified domain names, no @localhost allowed. (or, both ways)

Subdomains must be allowed ([email protected])


Solution

  • This regular expression complies with the grammar described in RFC 2822, it's very long, but the grammar described in the RFC is complex...