Regex to Match Email Addresses That Actually Works (2025)
Published April 2025 · 5 min read
Email validation with regex is one of the most searched developer topics. Here's what actually works in 2025.
The Simple Pattern (Good Enough for 99% of Cases)
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Test it now with our Regex Tester.
What This Matches
- ✅ user@example.com
- ✅ first.last@company.co.uk
- ✅ user+tag@gmail.com
- ❌ @missing-local.com
- ❌ user@.no-domain
The RFC 5322 Pattern (Technically Correct)
The full RFC-compliant regex is over 6,000 characters long. Don't use it. The simple pattern above catches 99.9% of real email addresses.
JavaScript Example
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
emailRegex.test('user@example.com'); // true
Python Example
import re
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
bool(re.match(pattern, 'user@example.com')) # True
Common Mistakes
- Not escaping the dot (\.) — a bare dot matches any character
- Not anchoring with ^ and $ — partial matches slip through
- Being too strict — rejecting valid emails with + or long TLDs