Test a regular expression against a subject, with every match, its position, and its numbered and named capture groups.
Regex Replacement Tester
Preview a regular expression replacement, with every match listed so you can check it before running it for real.
- Free
- No sign-up
- Runs in your browser
Input
0 characters
Processed entirely in your browser. Nothing is uploaded.
Fill in Pattern and Test string to continue.
Enter your input to see the result
Everything happens on this device. No upload, no account, no network request.
How to use this tool
- 1
Enter the pattern, the replacement and the text.
- 2
The result appears with every match listed beneath it, so you can confirm the replacement before applying it to real data.
Questions about Regex Replacement Tester
How do I insert a captured group?
`$1` for the first group, `$2` for the second, `
lt;name>` for a named group, and `amp;` for the whole match. A literal dollar sign is `$`. Note that `\1` works in a *pattern* as a back-reference but not in a replacement.Is my data sent anywhere?
No. This tool runs as JavaScript inside your browser tab. There is no network request carrying your input, nothing is written to a server log, and it keeps working with your connection switched off. You can confirm it in the browser’s network panel. That matters more here than elsewhere on the site: developer tools handle tokens, keys and production data.
Does the Regex Replacement Tester work offline?
Yes. Once the page has loaded it runs entirely as JavaScript on your own device, so the Regex Replacement Tester keeps working with the network switched off and nothing is ever sent to a server.
Is anything I enter into the Regex Replacement Tester uploaded or stored?
No. The Regex Replacement Tester runs in your browser, so whatever you type or paste never leaves your device — there is no server round-trip, nothing is logged, and there is nothing to delete afterwards.
Can I use the Regex Replacement Tester on a phone or tablet?
Yes. The page is responsive, so the Regex Replacement Tester works the same in a mobile browser as on a desktop, and there is no app to install.
Related tools
Other tools you might reach for next.
A reference table of JavaScript regular expression syntax, grouped by purpose, with an example for every token.
Format and indent JSON, with optional alphabetical key sorting and a precise syntax error when it will not parse.
Strip every byte of insignificant whitespace from JSON and report the saving.
Check that JSON is syntactically valid, report its structure, and flag duplicate keys that JSON.parse accepts silently.
Compare two JSON documents structurally, by path, distinguishing a type change from a value change.
Evaluate a JSONPath expression against a document and see every match with the path that produced it.
Escape text so it can be embedded as a JSON string value, handling control characters and astral code points.