Regex Replace

Find text with a regular expression and replace it, using captured groups in the replacement.

Input
Output

About this tool

Regex Replace runs a global search with your browser's JavaScript regex engine and substitutes every match (or only the first N when Max replacements is above 0). Unicode (u) is on by default: it enables \p{L}-style property classes and \u{…} escapes and treats emoji and other astral characters as single characters. Matching runs in a background worker; a pattern that takes longer than 1.5 seconds (catastrophic backtracking) is stopped and the page stays responsive.

Replacement references

  • $1 … $99 — numbered capture group.
  • $<name> — named group, from (?<name>…).
  • $& — the whole match; $` / $' — the text before / after it.
  • $$ — a literal dollar sign.
  • With Escapes in replacement on, \n, \t, \r and \\ are turned into a newline, tab, carriage return and backslash.

Privacy

All processing happens in your browser. Nothing you type is sent, stored or logged.