Skip to content
Hakoro

Regex Tester

New

Test JavaScript regular expressions with live match highlighting, capture groups and replace. Runs safely in your browser.

Runs in your browser. Nothing you enter is uploaded

Loading tool…

About Regex Tester

Write a regular expression and see what it matches as you type. Matches are highlighted in your text and listed with their capture groups, including named groups. Switch on Replace to try a replacement with $1 or $<name>.

Patterns run in the background with a time limit, so one that backtracks forever can't freeze the page. Your patterns and text stay in your browser.

How to use Regex Tester

  1. 1Type a pattern and choose flags (g, i, m, s, u, y).
  2. 2Paste the text to test.
  3. 3Read the matches and groups, or switch on Replace to preview a replacement.

Frequently asked questions

Which regex flavour is this?

JavaScript (ECMAScript), as used by browsers and Node.js. Most syntax is shared with other languages, but some features differ, such as lookbehind support and named group syntax.

Why did my pattern stop with “took too long”?

Some patterns, like (a+)+$, try exponentially many ways to match on certain text (catastrophic backtracking). The tester stops after two seconds. Make repetitions less ambiguous, for example by removing nested quantifiers.

How do I refer to groups in a replacement?

$1, $2… for numbered groups, $<name> for named groups, $& for the whole match and $$ for a dollar sign.

Is my text sent anywhere?

No. Matching happens in your browser.