Regex Tester

Write a pattern, toggle the g, i, m, s, u and y flags and see every match highlighted in your test text as you type. A table lists each match with its index, numbered groups and named groups, and the replace preview shows the result of $1 or $<name> substitutions. Matching runs in a background worker with a time limit, so a runaway pattern cannot freeze the page.

How to use the Regex Tester

  1. Type your regular expression in the pattern box.
  2. Toggle the flags you need.
  3. Paste test text and watch matches highlight live.
  4. Review groups in the match table.
  5. Enable Replace preview to test a replacement string.

Features

Benefits

Frequently asked questions

Which regex flavour does this use?

It uses your browser’s JavaScript (ECMAScript) engine, so results match JavaScript and Node.js. Other languages such as PCRE or Python differ in some features.

Why was my pattern stopped?

Patterns like (a+)+ can take exponential time on some inputs. Matching runs in a worker and is stopped after 1.5 seconds so the page stays responsive.

Why does only one match appear?

Without the g (global) flag JavaScript returns only the first match. Turn on g to find them all.

Related tools