Regex for Validating an Email Address
A commonly used pattern for basic email address validation.
Published October 10, 2026
A practical regex for email addresses checks for a local part, an @ sign and a domain with a dot. It will not cover every RFC case, but it catches obvious typos.
How the pattern works
Breaking the pattern down: ^ $ = anchors; [^\s@]+ = one or more characters that are not space or @; @ = literal at sign; \. = literal dot.
Test your regex against both matching and non-matching inputs; use the Regex tool on this site to experiment live.
Pattern tests
/^[^\s@]+@[^\s@]+\.[^\s@]+$/
✓ 'ada@example.com'
✓ 'a.b+tag@mail.co.uk'
✗ 'ada@example'
✗ '@example.com'
Practical examples
The pattern
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/Test it
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
re.test('ada@example.com') // true
re.test('a.b+tag@mail.co.uk') // true
re.test('ada@example') // false
re.test('@example.com') // falseIn Python
import re
re.search(r'^[^\s@]+@[^\s@]+\.[^\s@]+$', text)Common mistakes
- Trying to validate with a huge RFC regex.
- Rejecting valid plus-addresses.
- Treating regex as proof the mailbox exists (send a confirmation email).
Key takeaways
- Anchors (^ and $) make the whole string match instead of a part of it.
- Regex checks format only; verify data separately when it matters.
- Test with valid and invalid samples.
FAQ
Is this regex RFC-complete?
No; send a verification email for certainty.
Where can I test this pattern?
Use the Regex Tester on this site, or regex101.com.