Regex Tester

Test JavaScript regular expressions with live highlighting, capture groups and replace.

How to use the Regex Tester

Type a pattern and flags; matches highlight as you type, and the table lists every match with its capture groups. Use the replace box to preview String.replace with $1, $2 or named groups $<name>.

Quick reference

\d digit · \w word char · \s whitespace · . any char · * 0+ · + 1+ · ? optional · {2,4} range · ^ $ anchors · (?<name>…) named group · (?=…) lookahead.

Frequently asked questions

Which regex flavor is this?

JavaScript (ECMAScript), as used in browsers and Node.js. Most syntax also works in Python, Java and PCRE.

What do the flags mean?

g = all matches, i = ignore case, m = ^ and $ match line ends, s = dot matches newlines, u = Unicode.

Related tools