DevTools

Regex Tester

Test regular expressions with live match highlighting and groups.

Pattern

//gm

Test string

4 matches

Contact ada@example.com or grace.hopper@navy.mil for access.
Bounced: no-reply@example.co.uk, postmaster@mail.example.org
Not an address: @handle, plain text, 12345

Groups

at 8ada@example.com

$1ada

$2example.com

userada

domainexample.com

at 27grace.hopper@navy.mil

$1grace.hopper

$2navy.mil

usergrace.hopper

domainnavy.mil

at 70no-reply@example.co.uk

$1no-reply

$2example.co.uk

userno-reply

domainexample.co.uk

at 94postmaster@mail.example.org

$1postmaster

$2mail.example.org

userpostmaster

domainmail.example.org

Replace

lt;user> at
lt;domain>" class="w-full bg-transparent px-3 py-2 font-mono text-sm outline-none placeholder:text-slate-400 dark:placeholder:text-slate-600" value=""/>

About Regex Tester

Write a pattern and see what it matches as you type, with every match highlighted in place and each capture group listed separately. Flags are toggles rather than something to remember the letters for.

Capture groups

Numbered groups appear as $1, $2 and so on, and named groups written (?<name>…) appear under their name. Both can be used in the replacement field — $1 or

lt;name> — which is the quickest way to check a substitution before running it over real data.

Patterns that match nothing

A pattern where every part is optional, such as a* or \d?, matches an empty string at every position in the input. It is valid but almost never intended, so it is flagged rather than silently reported as hundreds of matches.

This is JavaScript regex

Flavours differ. Lookbehind, named groups and unicode property escapes work here, but PCRE features such as recursion and atomic groups do not exist in JavaScript, and Python or Go syntax will not always transfer unchanged.

Frequently asked questions

Why does my pattern only find the first match?
The global flag is off. Matching here always iterates so the count is meaningful, but keep g on if you intend to copy the pattern into code that expects every match.
How do I match across multiple lines?
Two different flags. Multiline (m) makes ^ and $ match at every line break; dotall (s) makes . match newline characters as well. They are independent.
Do I need to escape my slashes?
No. The pattern is read as text rather than as a literal between slashes, so a forward slash can be typed as-is. Backslash escapes such as \d and \w work normally.

Related tools