ToolMill

Regex Tester

Type a regular expression and a test text — matches light up as you type, with positions and capture groups listed below. Works with JavaScript (RegExp) syntax.

—

Cheat sheet

.Any character except a newline (with flag s: truly any character)
\d \w \sDigit / word character (letter, digit, _) / whitespace. Uppercase versions (\D \W \S) mean the opposite
[a-z] [^0-9]A character in the set / NOT in the set
* + ?0 or more / 1 or more / 0 or 1 of the previous item
{2,4}Between 2 and 4 of the previous item
^ $Start / end of the text (or of each line with flag m)
\bWord boundary — the edge between a word character and a non-word character
( ... )Capture group — its matched text is listed in the results and usable as $1, $2… in replacements
(?: ... )Group without capturing
a|b"a" or "b"
\. \\ \+A backslash escapes a special character so it matches literally

FAQ

Which regex flavor is this?

JavaScript's RegExp, the same engine your browser runs. Most everyday patterns behave the same in Python, PHP and other PCRE-like flavors, but lookbehind syntax and some flags differ between languages — test again in your target environment before shipping.

Why does only the first match show up?

Without the g flag, a regex stops at the first match. Tick the g checkbox to find all matches. Note that a pattern that can match an empty string (like a*) is handled safely here — empty matches are shown once per position instead of looping forever.

Is my text sent anywhere?

No. Testing and replacing happen entirely in your browser.

Related tools