Email Address Regex Generator Online
Paste a block of text and get back every email address in it. The pattern below is a practical starting point rather than a spec-compliant one, and the notes explain where it draws its line.
How it works
There is no single regular expression that matches every email address the RFCs allow, and that is not an oversight on your part. RFC 5321 permits quoted local parts, comments, and addresses up to 254 characters. A pattern that handles all of it is unusable in practice.
The pattern shipped on this page is the pragmatic one used in most real code: a local part of word characters plus dot, plus, and hyphen, an at sign, a domain of word characters and hyphens, and a top-level domain of at least two characters. It matches the addresses you actually receive, including plus-addressing and subdomain mailboxes.
Where it is deliberately wrong: it will not match a local part containing an at sign, a quoted string, or a space, all of which are technically legal. It will also match things that are not addresses, such as the trailing period in "Contact me at a@b.com." If your input is prose rather than structured data, expect a stray match or two and review the output.
Two flags matter here. The g flag makes the expression scan the whole string and return every match rather than stopping at the first. Without it you get one result and no indication that more were available. The i flag makes matching case-insensitive, which matters because email domains are conventionally written in lowercase while local parts are treated as case-sensitive by some providers.
This tool runs your pattern against your text on every keystroke, in your browser. Because a badly written pattern can backtrack exponentially and freeze the tab, patterns with a quantified group inside another quantifier — the classic (a+)+ shape — are detected and rejected with an explanation rather than being run.
Use the Email Address Regex Generator
Paste text on the left to see the result.Runs entirely in your browser — nothing you paste is uploaded or logged.
Worked examples
Real input and the exact output this page produces.
Example 1
Text
Contact ada@example.com or support@acme.co.uk for help.
Email addresses
ada@example.com
support@acme.co.uk
Frequently asked questions
Why not use the fully RFC-compliant pattern?
Because it matches addresses almost nobody receives, and it is slow and hard to read. The practical pattern matches real-world addresses; the notes explain where it differs from the specification.
What does the g flag do?
It makes the expression find every match in the input rather than stopping at the first. Without it you only ever see one result.
Is my text uploaded anywhere?
No. The pattern is compiled and run in your browser, so the text stays on your machine.
Why was my pattern rejected?
Patterns that nest a quantifier inside a quantified group can backtrack exponentially and lock the browser. Those are detected up front and rejected with an explanation instead of being run.
Related tools
Others doing similar work.