Regex Tester & Debugger

Test regular expressions with live match highlighting, capture and named groups, all JavaScript flags and a replace preview. Includes a regex cheat sheet.

Runs 100% in your browser. Nothing you paste is uploaded.

//
Flags:

Test string

0 matches

Matches & groups


Regex cheat sheet
\d \w \sdigit, word char, whitespace (\D \W \S = negated)
. ^ $any char, start, end (of line with m)
* + ? {n,m}quantifiers; add ? for lazy (*?)
[abc] [^abc] [a-z]character classes
(…) (?:…) (?<name>…)capture, non-capture, named group
(?=…) (?!…) (?<=…) (?<!…)lookahead / lookbehind
\bword boundary
a|balternation

About the Regex Tester

Write a pattern and see every match highlighted in the test text as you type. Each match lists its position, numbered capture groups and named groups. Add a replacement string to preview String.replace output using $1, $<name> and $&.

The engine is your browser’s JavaScript (ECMAScript) regex engine, which supports lookbehind, named groups, Unicode property escapes (\p{L} with the u flag) and the s (dotAll) flag.

Features

  • Live highlighting of all matches
  • Capture and named groups
  • Flags g, i, m, s, u, y
  • Replace preview
  • Clear syntax error messages
  • Built-in cheat sheet

How to use it

  1. Enter your pattern and flags.
  2. Paste the test text.
  3. Inspect matches and groups; optionally preview a replacement.

Frequently asked questions

Does this work for Java, Python or PCRE regexes?

Most syntax is shared, but there are differences — e.g. possessive quantifiers and atomic groups (PCRE/Java) are not supported in JavaScript, and Python uses (?P<name>…) for named groups.

Esc