Skip to main content

JavaScript Regex Replace Tester

Replace JavaScript regular-expression matches with native replacement tokens. Live preview runs locally in a worker; inputs are bounded and only the first match changes without g.

JavaScript RegExp flags: d, g, i, m, s, u, v, y (browser support varies). Replacement tokens: $$, $&, $1–$99, $<name>, $`, and $'. Without g, only the first match is replaced. Pattern: 500 code units; test text: 20,000; replacement: 2,000; output: 100,000. Preview runs locally in a worker, debounced by 350 ms and stopped after 250 ms.

Replaced text

Enter a pattern and text to see the replacement preview.

Was this tool helpful?