Script Valley
Regex: Actually Useful Patterns
Real-World Validation PatternsLesson 5.1

Email validation with regex what actually works

RFC 5321 overview, practical email regex, local part rules, domain rules, TLD length, common false positives, validation tradeoffs

Perfect Email Regex Does Not Exist โ€” Useful Ones Do

Email structure

RFC 5321 allows email addresses that no real provider accepts. The practical goal is rejecting obvious non-emails, not achieving 100% RFC compliance.

const emailRe = /^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/;

emailRe.test('user@example.com')     // true
emailRe.test('user@')                // false โ€” no domain

For production systems, send a confirmation email โ€” regex validates format, not deliverability.

Up next

URL validation and parsing with regex

Sign in to track progress

Email validation with regex what actually works โ€” Real-World Validation Patterns โ€” Regex: Actually Useful Patterns โ€” Script Valley โ€” Script Valley