How-to

How to Validate an Email with Regex

Use a pragmatic regex for structural validation, then confirm deliverability separately. Full RFC 5322 compliance is overkill and error-prone.

The practical regex

For structural email validation, a short pattern covers the common case: letters, digits, dots, underscores, percents, pluses, and hyphens in the local part; a domain with at least one dot; and a 2+ character TLD.

Practical email validator

Try this
/^[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}$/

Input

user.name+tag@sub.example.com

Result

Match

Rejects obviously invalid

Try this
/^[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}$/

Input

not-an-email

Result

No match

What this regex does NOT guarantee

It doesn't confirm the domain exists. It doesn't confirm the mailbox accepts mail. It rejects some technically-valid-but-weird addresses (quoted local parts, Unicode domains without puny-code encoding). Use it as a first-pass syntax filter, not as a guarantee of deliverability.

What to do after regex passes

Send a confirmation email with a one-click link. That's the only reliable test of deliverability. Services like SendGrid, Postmark, and AWS SES will bounce/soft-fail quickly if an address doesn't work, giving you cleaner feedback than any client-side check.

Common extensions you might want

International domains: add the u flag and replace character classes with \p{L} for Unicode letters. Plus-addressing: the pattern above already allows it. Disposable-email blocking: regex alone isn't enough — use a maintained list of throwaway domains.

Related patterns

All reference guidesOpen the RegexPro tester →