Text Replacer
Replace all literal matches or all matches of a JavaScript regular expression and inspect the replacement count. This is useful for repeated terminology edits while comparing the output with the original.
- Runs in your browser
- Nothing is uploaded
- No signup; device limits apply
Loading the tool. If it does not appear, reload this page.
How to use this tool
Enter source text, a search value and replacement text, then choose regex mode if needed. This implementation returns replacement text literally rather than expanding capture references such as $1.
Results and examples
Replacing cat with dog in cat cat performs two replacements and produces dog dog. Even in regex mode, a replacement of $1 inserts those characters rather than the captured group.
Limitations
- Regex mode uses the global g flag without a separate choice of other flags.
- Expensive patterns can slow long inputs; retain a copy and test a short example first.
Fields
| Field | Guidance and constraints |
|---|---|
| Source text | Check the unit and format displayed beside this field. |
| Find | Check the unit and format displayed beside this field. |
| Replace with | Check the unit and format displayed beside this field. |
| Use regex | Check the unit and format displayed beside this field. |
| Result | Check the unit and format displayed beside this field. |
Data handling
Processing stays in the current browser tab; the site does not upload tool input for the calculation itself.
Sources
Frequently asked questions
How is the replacement count interpreted?
Replacing cat with dog in cat cat performs two replacements and produces dog dog. Even in regex mode, a replacement of $1 inserts those characters rather than the captured group.
Does $1 refer to a capture group?
Regex mode uses the global g flag without a separate choice of other flags. Expensive patterns can slow long inputs; retain a copy and test a short example first.