Text & Code

Regex Tester

Test JavaScript regular expressions with live match highlighting, capture groups, named groups, match positions, and replacement preview.

● LOCAL ● NO NETWORK ● ECMAScript RegExp

Character classes

. Any char (except newline)
\w Word char [a-zA-Z0-9_]
\d Digit [0-9]
\s Whitespace
\W \D \S Negations
[abc] Character set
[^abc] Negated set
[a-z] Range

Quantifiers

* 0 or more
+ 1 or more
? 0 or 1
{n} Exactly n
{n,} n or more
{n,m} Between n and m
*? +? ?? Lazy (non-greedy)

Groups & anchors

(abc) Capture group
(?<name>abc) Named group
(?:abc) Non-capture group
(?=abc) Lookahead
(?!abc) Neg. lookahead
(?<=abc) Lookbehind
^ $ Start / end
\b \B Word boundary

Flags

g Global (all matches)
i Case-insensitive
m Multiline (^ $ per line)
s DotAll (. matches \n)
u Unicode mode
v Unicode sets (ES2024)
d Indices (hasIndices)

Quick examples

Related Workflow: Testing patterns against structured data? Use the JSON Formatter to inspect payloads, or use Text Diff to inspect line-by-line differences before and after regex replacements.

About JavaScript RegExp & Dialects

What it does

The Regex Tester evaluates a JavaScript regular expression against sample text and shows all matches highlighted inline. Each match is listed with its position, full value, numbered capture groups, and named capture groups. The replacement tab previews how String.prototype.replace() would transform the input. All processing happens in your browser using the native ECMAScript RegExp engine.

How it works

Patterns are compiled with new RegExp(pattern, flags). Matches are found using re.exec() in a loop. A guard of 5000 iterations prevents infinite loops on zero-length matches. Named groups are exposed via the match.groups object (requires the d flag or modern browsers).

No data leaves your browser. Pattern, flags, and test string may be saved in localStorage so you can resume where you left off.

Common mistakes & Dialect Differences

Limitations