How do backreferences work in the replacement string?
$1, $2, etc. insert text captured by each parenthesized group; $& inserts the whole match. E.g. (\d{2})/(\d{2})/(\d{4}) → $3-$1-$2 converts MM/DD/YYYY to YYYY-MM-DD.
Supports $1, $<name>, and \U...\E / \L...\E case conversion.
Run the replacement to see matches and the rewritten text.
Test JavaScript regular-expression replacements and inspect the result.
The replacement field accepts the same substitution patterns as String.prototype.replace — $1 for a capture group, $& for the whole match, $<name> for a named group, and $$ for a literal dollar sign. Without the g flag only the first match is rewritten. Wrap part of the replacement in \U...\E or \L...\E to force that span to upper- or lowercase — there is no native JavaScript equivalent, so this tool evaluates it after the substitution patterns above are resolved.
$1, $2, etc. insert text captured by each parenthesized group; $& inserts the whole match. E.g. (\d{2})/(\d{2})/(\d{4}) → $3-$1-$2 converts MM/DD/YYYY to YYYY-MM-DD.
Depends on the g (global) flag — without it, only the first match is replaced; with it, every match is replaced.
Regex Tester shows what matches and highlights groups. This tool shows the actual replaced output, so you can validate a transformation before running it on real data.
Yes — match a naming pattern and rewrite it with backreferences, previewing the exact output before applying it in your codebase.
Native JavaScript (ECMAScript) — the same engine as String.prototype.replace() in your browser or Node.js.
No — runs entirely in your browser.