Regex Replace
Regex Replace — transform text with patterns and replacements.
- Runs in your browser
- Free, no signup
Flags
Replacement tokens supported: $&, $1, $2, $`, $'
Your files are processed locally in your browser and are not uploaded to our server.
This tool helps you preview how a pattern will rewrite source text before you copy the result elsewhere.
It supports standard JavaScript replacement tokens such as $&, $1 and $` so you can match common developer workflows.
How to use this tool
- Add a regex, choose the flags you need and provide the text you want to transform.
- Add the replacement string and preview the before/after result.
- Use a single replacement for the first match or replace all matches in one pass.
Frequently asked questions
Does it change the original text immediately?
No. The preview is generated locally in the browser and the original value remains untouched until you copy or download the result.
Can I use replacement tokens?
Yes. The replacement field supports standard JavaScript syntax, including capture groups and special tokens such as $&, $1, $2, $` and $'.