Skip to content
Free tool · Data & formats

Regex Tester

Write a regular expression and see every match highlighted as you type, with numbered and named capture groups, a replace preview and a cheat sheet. Runs on the JavaScript regex engine, entirely in your browser — runaway patterns are stopped after one second.

Runs in your browser — nothing is uploadedNo sign-up · no tracking of your input

Regular expression

Flags
Examples

Test string

80 characters

Matches highlighted · running…

Contact: ada@example.com, grace.hopper+news@navy.mil
Invalid: alan@, @turing.org

Replace

Use $1…$99 for numbered groups, $<name> for named groups, $& for the match and $$ for a dollar sign.

Running…

Match details · JavaScript engine

Matching…

Cheat sheet

Characters

.
any character except line breaks
\d \w \s
digit, word character, whitespace
\D \W \S
the negations
[abc] [^abc]
one of / none of
[a-z]
range
\b
word boundary

Quantifiers

* + ?
0+, 1+, 0 or 1
{3} {2,5} {2,}
exact, range, at least
*? +?
lazy (as few as possible)
^ $
start / end (of line with m)

Groups

(abc)
capture group, $1 in replace
(?<name>abc)
named group, $<name>
(?:abc)
non-capturing group
a|b
alternative
\1 \k<name>
back-reference

Lookaround

(?=abc)
followed by
(?!abc)
not followed by
(?<=abc)
preceded by
(?<!abc)
not preceded by

How to use the Regex Tester

  1. 1

    Enter the pattern

    Type the expression without the surrounding slashes and switch the flags g, i, m, s, u and y on or off. Start from an example such as email, ISO date, IPv4, UUID or URL.

  2. 2

    Paste test text

    Matches are highlighted in the text and listed with their position and capture groups. Invalid patterns show the engine's error message.

  3. 3

    Preview the replacement

    Enter a replacement with $1, $<name> or $& to see the result of String.replace() before you put the pattern into your code.

FAQ

Regex Tester: frequently asked questions

Which regex flavor does this tester use?

It uses the JavaScript (ECMAScript) engine of your browser, the same one as RegExp in Node.js and the browser. Lookbehind, named groups, the s (dotAll) flag and Unicode property escapes like \p{L} are supported.

How is JavaScript regex different from Java or PCRE?

Most syntax is shared, but JavaScript has no possessive quantifiers (a++), no atomic groups, no inline modifiers like (?i) in older engines, no \A, \Z or \z anchors and no recursion. Java needs doubled backslashes in string literals, and PCRE/PHP use delimiters and flags such as /x. Test critical patterns in the target language too.

What does catastrophic backtracking mean?

Patterns with nested or overlapping quantifiers, such as (a+)+$ or (.*)*x, can take exponential time on input that almost matches. This tester runs the match in a Web Worker and stops it after one second, so your browser tab stays responsive. Rewrite such patterns with more specific character classes.

How do I use capture groups in the replacement?

Use $1 to $99 for numbered groups, $<name> for named groups written as (?<name>…), $& for the whole match and $$ for a literal dollar sign. Without the g flag only the first match is replaced.

Is my test data sent to a server?

No. The pattern and the text are processed only in your browser and are not uploaded or stored. You can safely test patterns against log lines or other internal data.