Tools Text

Regex Tester

Test JavaScript regular expressions with live highlighting, groups and replace.

🔒 Runs in your browser. Nothing is uploaded.

How to use it

  1. Type a pattern without the surrounding slashes, and its flags, such as g, i or m.
  2. Paste the text to test. Matches are highlighted as you type, in alternating colours so neighbouring matches stand apart.
  3. Read each match’s position and its numbered and named capture groups in the list below.
  4. Optionally type a replacement, using $1, $& or $<name>, to see the result of String.replace.

Questions

Which regex flavour is this?

JavaScript’s, as run by your browser’s own engine. It supports lookbehind, named groups and the d, s, u and v flags. Patterns from PCRE, Python or Go mostly work, but some syntax, like possessive quantifiers or (?i) inline flags, does not.

Why do I only see one match?

Without the g (global) flag, a regex stops at the first match. Add g to find them all.

Why did the page freeze?

Some patterns, such as (a+)+$, take exponentially long on certain inputs (catastrophic backtracking). The same pattern would hang your app too. Rewrite it so the nested repetition can’t match the same text in many ways.

Is my text uploaded?

No. Matching runs in your browser, and the page’s security policy blocks it from sending your data anywhere.