Mr. Encoder

Regex Tester

Test regular expressions with live highlighting, capture groups and replace preview.

How to use

  1. Enter your regular expression and toggle the flags you need.
  2. Type or paste test text; matches are highlighted live and listed with their capture groups.
  3. Open the Replace tab to preview a replacement using $1 or
    lt;name>.

Frequently asked questions

Which regex flavour does this tester use?

It uses your browser's JavaScript (ECMAScript) regex engine, the same one used by JavaScript and Node.js. Most syntax is shared with other flavours, but features such as possessive quantifiers or inline modifiers are not supported.

Why do I only get one match?

Without the g (global) flag a JavaScript regex stops after the first match. Enable g to find every match in the text.

What is catastrophic backtracking?

Patterns with nested quantifiers such as (a+)+ can take exponential time on some inputs. This tester runs matching in the background and stops it after a short timeout so the page never freezes.

How do I use capture groups in the replacement?

Use $1, $2 and so on for numbered groups,

lt;name> for named groups,
amp; for the whole match and $ for a literal dollar sign.

Other tools