/ TOOL · Regex

Regex Tester

Test regular expressions with live highlighting of all matches, numbered and named groups, a replace mode and a token-by-token explanation panel. JavaScript (RegExp) engine in a Web Worker with ReDoS protection — all locally in your browser.

Examples
Test text 0 matches
Matches and groups
Replace
Pattern explanation

Engine: JavaScript RegExp (ECMAScript flavor)

Matches are computed by your browser's native RegExp engine, run in a Web Worker. It is the same flavor you use in JS code — but it differs from PCRE (PHP, Perl, Python re):

  • No recursion (?R), atomic groups (?>…) or conditionals (?(1)…).
  • Named groups are written as (?<name>…) and backreferences as \k<name> (not (?P<name>)).
  • Anchors \A \Z \z do not exist — use ^ $ (per line with the m flag).
  • The d flag (hasIndices) adds group positions; u enables full Unicode mode and \u{…}.
Syntax cheat sheet

Anchors

^
start of input / line (m)
$
end of input / line (m)
\b
word boundary
\B
non-word-boundary

Character classes

.
any character (no \n)
\d \D
digit / non-digit
\w \W
word / non-word char
\s \S
whitespace / non-ws
[a-z]
range; [^…] negation

Quantifiers

*
0 or more
+
1 or more
?
0 or 1 (optional)
{n,m}
from n to m times
*?
lazy (as few as possible)

Groups

(…)
capturing group
(?:…)
non-capturing
(?<n>…)
named
\1 \k<n>
backreference
a|b
alternation

Lookaround

(?=…)
positive lookahead
(?!…)
negative lookahead
(?<=…)
positive lookbehind
(?<!…)
negative lookbehind

Flags

g
all matches
i
ignore case
m
^ $ per line
s
. matches newline
u y d
unicode / sticky / indices
/ FAQ

Frequently asked questions

Does this tool send my text to a server?

No. The entire regular expression tester runs in pure JavaScript in your browser — matching is computed in a Web Worker on your device. Nothing is sent anywhere, there is no backend and no telemetry, and your last pattern, flags and text are saved only locally in localStorage.

Which regular expression engine is used?

Your browser's native JavaScript (RegExp) engine. It is the ECMAScript flavor, which differs from PCRE: there is no recursion ((?R)), no atomic groups and no conditionals ((?(1)…)), and named groups are written as (?<name>…) with \k<name> backreferences. The d flag (hasIndices) adds group positions.

How does the tool protect against hangs (ReDoS)?

Matching runs in a separate Web Worker, and the main thread guards it with a watchdog. When a pathological pattern (e.g. (a+)+$ on a long input) does not return within the time budget, we call worker.terminate(), show a possible-ReDoS warning and spin up a fresh worker on the next run. The tab stays responsive.

Are named groups and match positions supported?

Yes. The match list shows the full match and start/end positions, and for every group — numbered and named (?<name>…) — its value. When the browser supports the d flag (hasIndices) we also show the positions of individual groups; without it a fallback works without group positions.