Search text with a JavaScript regular expression and replace every match in one pass. Keep the original text beside a separate result, including when the replacement removes all matching content.
Runs locally in your browserThe search field is a JavaScript regex pattern. A dot therefore has a special meaning: use \. to find an actual period. The operation runs in a browser worker without sending the entered text in a replacement request.
The tool uses the g flag only. It replaces non-overlapping matches, distinguishes uppercase from lowercase, and does not enable multiline, dotAll or Unicode mode. Regex syntax support follows your browser. A missing match returns the source unchanged.
An empty pattern is valid: ab with replacement - becomes -a-b-. These zero-width positions follow UTF-16 units, which can split an emoji. The tool does not normalize Unicode or interpret the result as HTML.
Replacement strings retain native JavaScript tokens: $1 for a captured group, $& for the full match, $$ for a dollar sign, $` for preceding text and $' for following text. Named groups can be referenced with $<name>. A typed \n in the replacement remains those two characters; it is not decoded into a line break.
Text is limited to 1,000,000 UTF-16 units, with 10,000 each for pattern and replacement. Results over 2,000,000 units are rejected after computation. A worker is stopped after a 2-second deadline, including startup; simplify the pattern or shorten the text after a timeout. No partial result is published.
No. The source remains available so you can adjust the pattern and retry. To replace within an earlier result, copy it into the source yourself. An empty result is valid and can still be copied.
Invalid syntax produces an error instead of an old result. Enter the pattern alone, for example \d+, not /\d+/g. If Web Workers cannot load, replacement is unavailable. Clipboard access may also depend on browser permissions; a failed copy leaves the displayed result available.