Regex pattern
Email Regex — free online tester
A practical email-validation regex that catches the 99% case without choking on every RFC edge case.
The pattern
[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/giHow it works
Email addresses follow a deceptively complex spec (RFC 5322). A full-coverage regex is hundreds of characters long and still gets corner cases wrong. In practice, the pattern below catches every email format you'll see in production input — local part with letters, digits, dots, underscores, percent signs, plus, hyphens; @ separator; domain with one or more labels; TLD of 2 or more letters.
When to use it
- ▸Frontend form validation before sending data to the server
- ▸Extracting email addresses from log files or scraped text
- ▸Cleaning up CSV / spreadsheet imports
- ▸Quick sanity checks in scripts and one-off shell commands
Tip
Use this as a first-pass filter, then verify the address actually exists by sending a confirmation email. Regex can't tell you the inbox is real.
Try it on this input
Contact us at [email protected] or [email protected]. Customers wrote in: [email protected], [email protected], [email protected] Bad ones: not.an.email, [email protected], @nodomain.org, plain text only
What this pattern doesn't catch
- ⚠Won't flag valid but unusual addresses with quoted local parts ("john doe"@example.com)
- ⚠Doesn't enforce IDN (internationalised) domains like 北京.中国
- ⚠Treats single-letter TLDs as invalid (none exist today, but the spec allows them)
More regex patterns
URL Regex
Extract every http(s) URL from a block of text — captures protocol, domain, path, query string, and fragment.
Phone Number Regex
Match US / Canada phone numbers in every common written format — with or without country code.
Date Regex (ISO 8601)
Match ISO 8601 dates (YYYY-MM-DD) and optionally times in any text — the format JSON APIs, databases, and logs use.
IPv4 Regex
Strictly match IPv4 addresses — rejects out-of-range octets like 256.0.0.1 that simpler patterns let through.
UUID Regex
Strict UUID pattern — validates version (1–7) and variant nibbles so random hex strings don't pass.
Credit Card Regex
Match credit-card numbers from major networks (Visa, Mastercard, Amex, Discover) for extraction or redaction.
Full Regex Tester →
Cheatsheet · pattern builder · cross-language translation · replace · explain · history
