0

Email Regex — Test a Pattern for Email Addresses

Debug JavaScript regular expressions live: highlighted matches, capture groups, flags, and replacement preview.

Supports $1, $2 and named references like $<name>; $& inserts the whole match. Leave empty to hide the preview.

Processing... 0%

Result

This page opens the regex tester preloaded with a practical email pattern: (?<user>[a-zA-Z0-9._%+-]+)@(?<domain>[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}). It captures the part before the @ into a named group called user and everything after it into domain, requiring a dot and at least a two-letter top-level domain. The sample text mixes valid addresses with strings that should not match, so you can see the boundaries of the pattern at a glance.

A perfect RFC 5322 email regex is famously enormous and still not a substitute for sending a confirmation message. In practice, a pattern like this one is the right tool: it accepts the addresses real people type — including dots, plus-tags and hyphenated domains — and rejects obvious garbage like a double @ or a missing top-level domain. Look at the match list below the text to inspect what landed in each named group.

Edit the sample text, paste your own address list, or tighten the pattern — every keystroke re-runs the expression and updates the highlights, the counter and the groups. When the pattern behaves, copy it straight into your form validation or log-parsing code.