CompleteSEOTools
Home › Developer Tools › Regex Tester

Regex tester

Type a pattern and some text and see every match, group and replacement at once.

About Regex Tester

This tester runs your pattern with the JavaScript regular expression engine that your browser uses, so what you see here is what a script on a web page would get. Matches are highlighted in the text and listed in a table with their position and any groups, including named ones. Add a replacement to preview the result of a replace call. The search runs in a background worker with a time limit, so a pattern that backtracks forever is stopped instead of freezing the page.

  • Building a pattern step by step against real sample text.
  • Checking what each capture group picks up before you use $1 in a replacement.
  • Seeing the effect of the g, i, m, s, u and y flags side by side.
  • Catching a pattern that is slow on long input before it reaches production.

How to use Regex Tester

1

Step 1

Type the pattern without slashes and tick the flags you need.

2

Step 2

Paste the text to search. Matches are highlighted as you type.

3

Step 3

Optionally add a replacement such as $2/$1 to preview the changed text.

Good to know

  • This is the JavaScript flavour only. Python, PCRE, Java and .NET differ in details such as lookbehind, possessive quantifiers and named group syntax.
  • If a pattern is stopped after 1.5 seconds, look for nested repeats like (a+)+. They can take exponential time on text that almost matches.
  • Without the g flag, JavaScript returns only the first match, and the replacement changes only that one.

Common questions

Why do I see only one match?

The g (global) flag is off. Without it a JavaScript regular expression stops after the first match. Tick g to list them all.

What does the time limit protect against?

Some patterns take a very long time on certain text, which can lock up a page. The test runs in a worker and is cancelled after 1.5 seconds, and at most 1000 matches are listed.

Is my text uploaded?

No. The pattern and text stay in your browser and are processed by a worker script created on the page.