Regex Tester
Test regular expressions in your browser. View match groups, run replace operations, and reference the built-in cheat sheet.
Runs entirely in your browser. Nothing is sent to our servers.
About this tool
This tester runs your regex against your test input using the native
JavaScript RegExp engine — entirely in your browser. The
highlighted view shows what your pattern matches in real time. Each match
is listed with its position and capture groups below.
JavaScript regex flavour
JavaScript regex differs in a few important ways from PCRE (PHP/Perl) and
Python's re module. A few notable points:
- Lookbehind (
(?<=...),(?<!...)) is supported in all modern browsers. - Possessive quantifiers (
a++,a*+) are not supported. Use atomic groups or refactor. - Named groups use
(?<name>...)and are accessed viamatch.groups.name. - Unicode property escapes like
\p{L}require theuflag.
Replacement syntax
In the replacement field, use $1, $2, etc. to
reference capture groups, or $<name> for named groups.
Use $& for the entire match and $$ for a
literal $.
Frequently asked questions
- Why doesn't my pattern match anything when I expect it to?
- Most common: forgetting the
gflag (without it, only the first match is found and the highlight only shows one); using a regex anchor like^/$without themflag in multi-line input; or special characters like.,(,+not being escaped when meant literally. - How do I match across newlines?
- For
.to match newlines, use thes(dotall) flag. For^/$to match the start/end of each line instead of the whole string, use themflag. The two flags are independent. - Can this catch a catastrophic backtracking regex?
- The browser will eventually finish or freeze. If your pattern locks up the page, that's a sign of catastrophic backtracking — typically nested quantifiers like
(a+)+against a long non-matching input. Refactor to be linear (anchored or with possessive-like constructs). - Are the test input and pattern logged anywhere?
- No. Everything runs in your browser via the native
RegExpengine. Nothing is transmitted.
Last updated: May 17, 2026