Regex Tester

Try out a regular expression and watch matches highlight as you type. Capture groups are listed, and you can test a replacement too.

Flags

Matches 0

Replace matches

Runs in your browser. What you enter here is not sent to our server.

  • Live match highlighting
  • Capture groups listed
  • Replacement preview

How to use the Regex Tester

  1. Type a pattern without the surrounding slashes.
  2. Paste the text to test against.
  3. Matches are highlighted and listed with their groups. Open Replace matches to try a substitution.

Handy building blocks

PatternMatches
\d, \w, \sA digit, a word character, white space
.Any character except a line break
+, *, ?One or more, zero or more, optional
{2,4}Between two and four of the previous item
^ and $Start and end of the text (or line, with the m flag)
(…)A capture group, reused as $1 in a replacement
[a-z], [^0-9]Any character in the set, or not in it

Questions about the Regex Tester

Which regex flavour is this?

JavaScript, as implemented by your browser. Most patterns carry over to other languages, but features such as lookbehind and named groups vary between engines.

Why does my pattern match only once?

Tick “All matches (g)”. Without the global flag a regular expression stops at the first match.