Pattern library / Strings & Text
Strict Regex to Validate Email Addresses
Stricter than the basic email regex: requires a TLD of at least 2 letters and rejects obviously invalid shapes. Still not a substitute for sending a verification email.
How the pattern works
[A-Za-z0-9._%+-]+— local part (common chars).[A-Za-z0-9.-]+— domain with dots/hyphens.\.[A-Za-z]{2,}— TLD of 2+ letters.- Regex can't verify the mailbox exists — send a verification email.
Test it: match & no-match examples
Every row is loaded straight into the tester — click Try to see the match live:
| Input | Result | Why | |
|---|---|---|---|
user@example.com | Match | valid email | Try → |
first.last+tag@sub.example.co.uk | Match | subdomain + multi-part TLD | Try → |
user@example | No match | missing TLD | Try → |
user@.com | No match | empty local part domain | Try → |
@example.com | No match | missing local part | Try → |
Where to use it
JavaScript
const re = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/;
re.test('user@example.com'); // true
Python
import re
re.match(r'^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$', 'user@example.com')
Common mistakes
Test this pattern on your own data
Paste it into the free tester with your real strings — nothing leaves your browser.
FAQ
Related patterns
For GA4-specific patterns, see the GA4 regex cheat sheet, the page path regex guide, the event filter regex guide, the GA4 regex match types, the custom channel grouping guide and RE2 vs PCRE. Browse the full regex pattern library.