Regex tester

A regex tester shows which parts of a text match a regular expression and what each capture group contains. This one uses JavaScript regex syntax.

Features

  • Live highlightingSee matches and groups.
  • SafeRunaway patterns are stopped after one second.
  • Runs on your deviceYour data is processed in the browser and is never uploaded.

How to use the regex tester

  1. Enter the pattern without surrounding slashes.
  2. Set flags such as g, i or m.
  3. Paste test text and read the highlighted matches.

Catastrophic backtracking

Some patterns take exponential time on certain input. Matching runs in a background worker here and is stopped after one second.

Use a regular expression in JavaScript

for (const match of text.matchAll(/(\d+)-(\d+)/g)) {
  console.log(match[0], match[1], match[2]);
}

Frequently asked questions

Which regex flavor is this?

JavaScript (ECMAScript). PCRE, Python and Go differ in places.

What does the g flag do?

It finds every match, not just the first.

How many matches are shown?

Up to 500 are highlighted and the first 50 listed.

Related tools