Email AddressRegex — Pattern, Examples & Code
^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$What it matches / doesn't match
| Matches ✅ | Does not match ❌ |
|---|---|
●user@example.com | ●userexample.com |
●first.last+tag@sub.domain.org | ●@nodomain.com |
●admin123@company.io | ●user@@double.com |
How it works
Matches a local part (letters, digits, dots, underscores, percent, plus, hyphen) followed by @ and a domain with at least one dot and a TLD of two or more letters. It rejects addresses without an @ sign, consecutive dots, or missing TLD. This pattern covers the vast majority of real-world email addresses without full RFC 5322 complexity.
Code Usage
JavaScript
const regex = /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/;
regex.test("user@example.com"); // truePython
import re
pattern = re.compile(r'^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$')
bool(pattern.match("user@example.com")) # TrueGo
import "regexp"
r := regexp.MustCompile(`^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$`)
r.MatchString("user@example.com") // trueNeed a custom regex for a different use case?
Generate a custom regex with AI →FAQ
What does the Email Address regex pattern match?
Matches a local part (letters, digits, dots, underscores, percent, plus, hyphen) followed by @ and a domain with at least one dot and a TLD of two or more letters. It rejects addresses without an @ sign, consecutive dots, or missing TLD. This pattern covers the vast majority of real-world email addresses without full RFC 5322 complexity.
How do I use the Email Address regex in JavaScript?
const regex = /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/; regex.test("user@example.com"); // true
Can I use the Email Address regex in Python?
Yes. import re pattern = re.compile(r'^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$') bool(pattern.match("user@example.com")) # True
