Updated · Built and checked by the PlinzoTools team, formulas tested against published sources
Find and replace text, optionally using a regular expression.
The dog sat on the mat.This tool replaces every occurrence of a search term in text with a replacement -- either as a literal string match or, when enabled, a full regular expression -- and reports exactly how many replacements were made.
Enter your text, a search term, and a replacement. Toggle regex mode and case-sensitivity as needed. The result and replacement count update instantly.
In literal mode, special regex characters in your search term (like . or *) are automatically escaped so they match literally. In regex mode, the search term is compiled as a full JavaScript regular expression, enabling pattern-based matching (like \d+ for any run of digits).
To test a regex pattern's matches without replacing anything, use the Regex Tester instead.
Stay in literal mode whenever the thing you are looking for is ordinary text. It is safer, because characters such as a period, asterisk, parenthesis, or question mark are automatically treated as plain characters. Switch to regex mode only when you need patterns: digits, optional characters, alternatives, or word boundaries. In regex mode the pattern is a JavaScript regular expression, so syntax from other flavours, such as certain lookbehind or named group syntax, may behave differently from what you are used to elsewhere. If the pattern is invalid, the tool shows an error message from the browser instead of changing your text.
The counter reports how many matches were replaced. A count of zero tells you the search did not match, which is the first thing to check when nothing seems to have changed: look for case differences, stray spaces, or regex characters in literal-looking text. An unexpectedly high count in regex mode often means the pattern is too greedy or too general. Empty searches in literal mode do nothing and report zero. In regex mode an empty pattern matches at every position, so avoid that.
The replacement text is inserted exactly as typed, in both modes. Unlike some editors, this tool does not expand capture-group references, so typing a dollar sign followed by a digit will insert those characters literally, not the text matched by a group. If you need to rearrange matched text, do it in several simple steps or in a code editor that supports back-references.
Keep a copy of the original text until you are happy with the result. Test regex patterns on a small sample before running them on a large document, and use the Regex Tester to inspect matches when a pattern is complicated. Chain several simple replacements rather than writing one very complicated pattern.
They're automatically escaped so they're matched literally (e.g. a period matches only an actual period, not "any character" as it would in regex) -- no need to manually escape anything yourself in literal mode.
No -- the replacement is inserted as fixed text, so $1 is written out literally rather than being swapped for the first capture group. Regex mode only affects how the search pattern matches.
Yes, by default -- toggle case-sensitivity off if you want "Cat" and "cat" to be treated as the same search term.
No. It replaces every match in the text, and the counter shows how many there were.
Turn on regex mode and search for \n, then enter the replacement you want, such as a comma and space.
Matching is by character sequence, not whole words. In regex mode, use \bcat\b to match only the standalone word.
Reference: MDN Web Docs