Regex tester.

Test regular expressions against your own text, with live match highlighting and an optional replace preview.

/ /

How do I test a regular expression?

Type your pattern into the box at the top (without the surrounding slashes), tick whichever flags you need, then paste some text into the 'Test string' box. Matches are highlighted instantly below, and every match, along with any capture groups, is listed further down the page.

If your pattern is invalid, you'll see an error explaining what's wrong instead of a silent failure.

What do the flags mean?

Global (g) finds every match in the text rather than stopping at the first one. Ignore case (i) makes the match case-insensitive. Multiline (m) makes ^ and $ match the start and end of each line rather than just the whole string.

Dot all (s) makes . match newline characters too, which it doesn't by default. Unicode (u) enables full Unicode matching, treating surrogate pairs as single characters. Sticky (y) anchors matching to exactly the current position in the string.

Common pattern reference

.Any character except a newline
\dAny digit (0-9)
\wAny word character (letters, digits, underscore)
\sAny whitespace character
^ / $Start / end of the string (or line, with the m flag)
* / + / ?0 or more / 1 or more / 0 or 1 of the previous token
{n,m}Between n and m repetitions of the previous token
(...)A capture group
[abc]Any one of the characters a, b or c
a|bEither a or b

Is my text sent anywhere?

No. Matching runs entirely in your browser using JavaScript's built-in regular expression engine, so nothing you type is ever uploaded or stored.

How does the replace preview work?

Enable 'Show replace preview' in the settings, then enter a replacement string. You can reference capture groups from your pattern using $1, $2 and so on. The preview shows what your test string would look like after running it through String.replace() with your pattern and replacement.

No tools match your search.