Regex for Email Validation
Test and validate email address patterns with regular expressions. Copy ready-to-use email regex patterns for JavaScript, Python, and more.
Open Regex Tester →Email Regex Patterns
The most common email regex pattern is
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$. This validates the basic structure: local part, @ symbol, and domain. However, the full RFC 5322 email specification is extremely complex — a fully compliant regex would be hundreds of characters long. For most applications, the simple pattern above catches 99% of valid emails while rejecting obvious garbage.When to Use Regex for Emails
- Client-side validation: Quick feedback before form submission — catch typos like missing @ or domain.
- Server-side validation: Always validate on the server too. Regex checks format; sending a confirmation email verifies deliverability.
- Data cleanup: Filter invalid entries from CSV imports or database migrations.
Remember: regex validates format, not whether the email actually exists. The only way to truly validate an email is to send a message to it.
// Simple email regex (covers 99% of cases)
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
// JavaScript validation
function isValidEmail(email) {
return /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(email);
}
// Python
import re
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
is_valid = bool(re.match(pattern, email))