Regex Replace Playground
Test regex replacements with capture groups before using them elsewhere.
Test regex replacements safely
A find-and-replace with capture groups can transform text elegantly — or wreck it if the pattern is slightly off. This playground lets you test a regex replacement, including $1-style group references, against sample text before you run it for real.
Previewing the result catches greedy matches and group mistakes before they touch your files or database. Enter a pattern, a replacement, and some text, and confirm the transformation does exactly what you intend.
Capture groups, safely
Testing a find-and-replace with capture groups on real text catches a pattern that would otherwise wreck it. Everything runs in your browser and never uploads anything.
Frequently asked questions
How do I use capture groups in the replacement?
Wrap part of the pattern in parentheses, then use $1, $2, and so on in the replacement. For example, pattern (\w+)@ with replacement [$1] rewrites the part before the @.
Does it replace every match?
Yes. Replacements run with the global flag, so all matches in the text change.
Which regex syntax does it use?
JavaScript regular expressions, the same syntax used by String.replace in the browser and Node.
Related tools
Practical utilities for everyday web development work.