Regex to Match an Email Address
Copy the pattern, paste your text below, and see every email it finds. Below the tester: what each part does, and why you should not try to match the full RFC.
What this pattern matches
This expression matches the email addresses you actually see in real text: a local part, an @, a domain, and a top-level domain of at least two letters. It handles dots, plus-tags (name+tag@…), and sub-domains.
How it works, part by part
[A-Za-z0-9._%+-]+ — the local part: letters, digits, and the common symbols . _ % + -.
@ — the literal at-sign.
[A-Za-z0-9.-]+ — the domain, including any sub-domains separated by dots.
\.[A-Za-z]{2,} — a dot followed by a top-level domain of two or more letters.
Why not match the full spec
The official RFC 5322 grammar for email is enormous and allows addresses almost no real system accepts. A pragmatic pattern like this one catches essentially every address a user will type, without false-rejecting valid ones. For sign-up forms, the only reliable validation is sending a confirmation email.
FAQ
Does it match plus-tagged addresses like name+tag@example.com?
Yes. The local-part class includes +, so name+tag@example.com matches.
Why require two letters in the TLD?
The {2,} quantifier rejects a bare foo@bar with no dot-suffix while allowing modern long TLDs like .studio or .co.uk.
Should I anchor it with ^ and $?
Only when validating a single input field. To find every email inside a block of text, leave it unanchored and use the g flag.