Email Address Validation Regex
Validate email addresses with this regex pattern. Matches standard email formats like user@example.com.
Pattern & Test String
About This Pattern
Pattern: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Flags: g
Results
Enter a regex pattern to see the results here.
Frequently Asked Questions
What email formats does this pattern match?
This pattern matches standard email addresses with alphanumeric characters, dots, underscores, percent signs, plus signs, and hyphens in the username, followed by @ symbol, domain name, and a top-level domain of at least 2 characters.
Does this validate international email addresses?
This basic pattern works for ASCII characters only. For international (Unicode) email addresses, you'll need a more complex pattern or use email validation libraries that support IDN (Internationalized Domain Names).
Can I use this for form validation?
Yes, this pattern works well for basic email validation in web forms. However, consider using HTML5's built-in email validation type='email' or a dedicated email validation library for production use.
What are common edge cases this pattern handles?
This pattern handles emails with subdomains (user@mail.example.com), plus addressing (user+tag@example.com), and emails with dots in the username (first.last@example.com).
Practical Examples
Form Validation
Validate email input in registration or contact forms before submission.
Email Extraction
Extract email addresses from text documents or log files for analysis.
API Request Validation
Validate email format in API requests before processing user data.
Common Issues & Solutions
The pattern may reject valid emails with special characters. For strict RFC 5322 compliance, use a specialized library.
Remember that regex validation only checks format, not if the email actually exists. Use SMTP verification for that.
For case-insensitive matching, enable the 'i' flag to accept emails like USER@EXAMPLE.COM.
This pattern requires at least a 2-character TLD (.com, .org), so single-letter TLDs like example.x won't match.