Skip to content
Mediawand

Regex Tester

Build and debug regular expressions against your own text. Matches are highlighted as you type, capture groups are listed for each match, and you can preview a replacement.

How to test a regular expression

  1. 1Type your pattern and choose flags such as global or ignore case.
  2. 2Paste the text to test against.
  3. 3Check the highlighted matches and groups, and preview a replacement if you need one.

JavaScript syntax

Patterns use JavaScript's regular expressions, as in browsers and Node.js, including lookbehind, named groups (?<name>…) and Unicode property escapes like \p{L} with the u flag.

Groups and replacements

Each match lists its numbered and named groups. In the replacement, $1 inserts group 1, $<name> a named group and $& the whole match, the same as String.replace.

Safe from runaway patterns

Some patterns, such as (a+)+$, can take forever on certain text. Matching runs separately from the page and stops after 2 seconds, so a bad pattern never freezes your browser.

Frequently asked questions

Is my text uploaded?
No. Matching runs in your browser.
Why does my pattern from Python or PHP behave differently?
Each language has small differences. Possessive quantifiers and some inline flags aren't supported in JavaScript, for example.
How many matches are shown?
Up to 1,000 matches are found and the first 100 are listed in detail.

Related tools

Loading tools…