Email regex looks simple but is famously hard to get right - the full RFC 5322 regex is over 6,000 characters. Most code uses a 'good enough' pattern that catches obvious typos without being technically perfect. Test your email regex against a list of common edge cases (plus signs, subdomains, IPv6 literals, etc.) to see what passes and fails.
When to use this
Use to: validate email regex used in signup forms, test email patterns in lead-capture / contact forms, audit existing regex in your codebase, generate a robust email pattern for a specific use case (corporate emails only, no plus signs, etc.).
Frequently Asked Questions
Should I use the simple or RFC 5322 email regex?
Simple. The full RFC 5322 regex catches edge cases (quoted strings, IPv6 literals, comments) that almost never appear in real signups. A simple regex like `[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}` catches 99.9% of valid emails and rejects obvious typos. Send a verification email for the rest.
Why does '+' work in real emails (e.g. gmail+tag@gmail.com)?
RFC 5322 allows + in the local part. Most email providers accept it; Gmail famously uses + as a sub-address marker. A regex that rejects + breaks Gmail's plus-addressing feature - if you do this, you'll get bug reports from power users.
Powered by Regex Tester.