Regex Replace + Group Preview
Live three-pane editor: **Pattern** (/.../flags) + **Replacement** ($1, $2, $<name>) + **Input**. See highlighted matches in the source, the replaced output, and a table of every match's captures (including named groups). All 6 flags toggleable.
//gu
$1β$9 = captures; $<name> = named group; $& = full match; $$ = literal $
3 matches
alice@example.com, bob@dev.tw, c@x.org
mark.liu@psp-power.com.tw
| # | Match | Captures |
|---|---|---|
| 1 | alice@example.com | $1: alice $2: example $3: com |
| 2 | bob@dev.tw | $1: bob $2: dev $3: tw |
| 3 | c@x.org | $1: c $2: x $3: org |
βΊHow to use
- Type a regex into Pattern β the flag chips on the right apply automatically; syntax errors surface inline.
- Use Replacement with
$1,$2(numeric captures),$(named groups),$&(whole match), or$$(literal $). - Toggle any of 6 flags (g/i/m/s/u/y) live.
- Read off, in order: source with hl-highlighted matches, the replaced output, and a per-match captures table.
Tips
- Without
gwe still walk every match (less confusing than seeing only the first). uis on by default β required for\p{Script=Han}-style Unicode property escapes.s(dotAll) lets.match newlines β invaluable for multi-line captures.y(sticky) only matches fromlastIndex. Mostly for lexers; rarely needed casually.- vs regex101.com: powerful but heavy and ad-supported. We're light + offline + instant.
π‘ Runs 100% locally β pattern and input never leave your browser. Safe for PII. Zero-width matches are protected against infinite loops.
Related tools
- JWT decoder / generatorDecode header / payload / expiry, re-sign with secret
- cURL β fetch β Python converterPaste a cURL command β emit fetch / Python requests / HTTPie
- CSS / XPath selector testerPaste HTML + selector β live highlight of matches
- Regex builder & live testerPattern + sample text β live highlight + capture groups