Overview
Tests JavaScript regular expressions against live text with a token-by-token plain-language breakdown, inline match highlighting, a matches-and-capture-groups table with positions, replacement previewing with $1 and
lt;name>, and catastrophic-backtracking protection — matching runs in a background worker that is terminated after a timeout, so an evil pattern freezes the worker, never your tab.How It Works
Type the pattern and toggle any of the seven flags — g, i, m, s, u, y (sticky) and d (has indices) — each labelled with what it actually changes. Below the test string, the match table lists every match with its index, length, full text, and all numbered and named capture groups with their [start–end] positions. The pattern breakdown pane explains your expression token by token in plain language — what (?<name>, [a-z], {2,4}, or \b each does. The replacement preview applies String.prototype.replace live and surfaces syntax errors in the substitution string, with a substitution reference and a quick-reference cheatsheet alongside.
Step-by-Step Usage Guide
- Enter the pattern; read the breakdown pane to check each token does what you intend.
- Toggle flags — hover any flag button for what it changes.
- Paste your test corpus and read the match table, including group values and positions.
- Preview the replacement (with $1 or lt;name> backreferences), then copy the regex.
Technical Specifications & Standards
Matching uses the native ECMAScript RegExp engine, so lookbehind, named groups, and unicode property escapes behave exactly as they will in Node or the browser. ReDoS protection is layered: a static analyser flags nested-quantifier shapes like (a+)+$, (.*)*, and overlapping alternations before matching starts, and refuses to run clearly dangerous patterns on long inputs; meanwhile execution happens inside a Web Worker created from a Blob URL with a hard wall-clock timeout — if matching exceeds it, the worker is terminated, the page stays interactive, and a warning explains what happened. A zero-length-match guard and a match-count cap (1,000) keep the result list bounded; the d flag (added automatically for scanning) supplies per-group positions.
Targeted Use Cases
- Building validation patterns for emails, IPv4 addresses, or ISO dates — quick-start patterns for all three are included.
- Learning what an unfamiliar regex from a codebase or Stack Overflow answer actually matches, via the token breakdown.
- Extracting structured fragments from log lines, with capture-group positions for downstream slicing.
- Checking a replacement expression — including lt;name> backreferences — before committing it to production code.
Notes & Gotchas
- Take the amber backtracking warning seriously: nested quantifiers are fine on short inputs and explosive on long ones. The worker timeout stops runaway matching after 1.5 seconds, but you lose the results.
- The match table is capped at 1,000 matches (the preview notes truncation); narrow the pattern or input if you need beyond it.
- The sticky (y) flag anchors matching at lastIndex; it is mainly useful for tokenizer loops rather than interactive testing.
- Saved patterns persist in your browser's localStorage only — convenient across visits, but they never sync anywhere.
Frequently Asked Questions
Which regex dialect does this use?
The native ECMAScript RegExp engine — lookbehind, named groups, and unicode property escapes all work exactly as they will in Node or the browser.
Does it protect against catastrophic backtracking?
Yes. A static analysis warns about dangerous shapes like (a+)+$ and refuses them on long inputs, and all matching runs in a Web Worker that is terminated after 1.5 seconds — the page never freezes.
Can I see each capture group's value?
Yes — the matches table shows every numbered and named group's text and its [start–end] position for each match.
Is my test data uploaded?
No. Matching runs in a worker inside your browser session; nothing is transmitted.