Skip to content
Utilizy

Regex Tester

See matches live, and test replacements

Runs in your browser

Input

//gm

Refer to capture groups as $1, $2 and so on.

Result

Result

Nothing entered yet

Enter a pattern and some test text — the results appear here.

Regular expressions are written by trial and error, and doing that inside your code means a rebuild for every attempt. Paste your sample text here and watch the matches move as you edit the pattern.

How to use

  1. 1 Enter the pattern — without the surrounding slashes.
  2. 2 Paste the text you want to test against.
  3. 3 Toggle the flags you need.
  4. 4 Add a replacement string to preview the substitution.

Frequently asked questions

What do the flags do?

g finds every match rather than stopping at the first, i ignores case, m makes ^ and $ match at line boundaries, and s lets the dot match newlines. Missing g is the single most common cause of "it only replaces once".

How do capture groups work?

Parentheses capture the matched portion. Refer to them as $1, $2 and so on in the replacement. Use (?:...) when you want grouping without capturing.

Why does my pattern hang the page?

Catastrophic backtracking — usually nested quantifiers like (a+)+ against text that nearly matches. The engine tries exponentially many combinations. Make the inner parts more specific or use non-greedy quantifiers.

Works well with