Regex Replace Tester

Replace settings

Supports $1, $<name>, and \U...\E / \L...\E case conversion.

Flags
Empty/g

Result

Run the replacement to see matches and the rewritten text.

Not runUTF-8

About this Regex Replace Tester

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.

FAQ

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.

Does this replace all matches, or just the first?

Depends on the g (global) flag — without it, only the first match is replaced; with it, every match is replaced.

What's the difference between this and the Regex Tester?

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.

Can I use this for renaming variables or refactoring code snippets?

Yes — match a naming pattern and rewrite it with backreferences, previewing the exact output before applying it in your codebase.

Which regex flavor does this use?

Native JavaScript (ECMAScript) — the same engine as String.prototype.replace() in your browser or Node.js.

Is my pattern or text sent anywhere?

No — runs entirely in your browser.

Related tools