About the Find and Replace Text
This find and replace tool changes every occurrence of a word, phrase or pattern in a block of text in one step. Paste your text, type what to find and what to replace it with, and copy the updated version. It shows how many matches were replaced and lists where each one was found, by line and column.
It is handy for updating a year or product name throughout a document, fixing a repeated typo, swapping a placeholder like {name} in a template, cleaning exported data, or reformatting lists of phone numbers, dates and codes. Whole-word matching stops "cat" from also changing "catalog", and case-sensitive matching lets you change "Apple" without touching "apple".
For advanced edits turn on regular expressions: the find box then accepts JavaScript regex syntax, and the replacement can reuse captured groups with $1, $2 and so on, plus \n for a new line. Everything runs locally in your browser, so private documents never leave your device.
How to use the find and replace text
- 1Paste the text you want to edit.
- 2Type the word or phrase to find and its replacement.
- 3Turn on match case or whole words if needed.
- 4For patterns, switch on regular expressions and use $1, $2 for captured groups.
- 5Copy the updated text.
Formula and method
In normal mode the search text is escaped so every character is matched literally, then every occurrence is replaced from left to right; matches never overlap, so replacing "aa" in "aaaa" makes two replacements. "Match case" controls whether upper- and lowercase letters must match exactly, and "Whole words only" accepts a match only when the character before and after it is not a letter, digit or underscore, so it will not match inside a longer word but still works for terms that begin or end with a symbol, such as "$12" or "C++". Word characters here are the basic Latin letters A–Z, digits and underscore, so accented letters count as word breaks.
With regular expressions on, the find box is a JavaScript regular expression evaluated with the global and multiline flags, so ^ and $ match at the start and end of each line. In the replacement, $& inserts the whole match, $1–$9 insert captured groups, and \n or \t insert a new line or tab. Regex mode runs your pattern as written: a pattern with nested repetition such as (a+)+ can take extremely long on some text and briefly freeze the tab, so prefer simple, specific patterns.
- $1, $2…
- Text captured by the first, second… parenthesised group (regex mode)
- $&
- The entire matched text (regex mode)
Worked examples
Updating the year in a document
All three occurrences of "2025" across the two lines are changed to "2026" in one pass.
Whole-word, case-insensitive replace
Because case is ignored, "Cat", "cat" and "CAT" all match, but whole-word mode leaves "catalog" alone. Three replacements are made.
Whole-word match on a price
Whole-word mode changes the standalone "$12" but not the start of "$120", because the character after the match there is a digit. The "$" in the replacement is inserted literally because regex mode is off.
Reformatting phone numbers with regex
The pattern captures the area code, prefix and line number as groups 1–3, and the replacement rebuilds them as "(555) 123-4567". Both numbers are reformatted.
Frequently asked questions
How do I delete a word from all of my text?+
Type the word in the Find box and leave Replace with empty. Every match is removed. Turn on "Whole words only" so the word is not removed from inside longer words, and replace "word " with a trailing space to avoid double spaces.
How do I replace line breaks or tabs?+
Turn on regular expressions, then search for \n to match a line break or \t for a tab. For example, find \n and replace with ", " to turn a list into a comma-separated line.
What is the difference between match case and whole words?+
"Match case" makes the search treat "Apple" and "apple" as different. "Whole words only" ignores matches that are part of a longer word, so searching for "art" will not change "start" or "article".
How do capture groups work in the replacement?+
In regex mode, parts of the pattern wrapped in parentheses are numbered from left to right. In the replacement, $1 inserts the first group, $2 the second and so on, letting you reorder or reformat pieces of each match.
Is there a limit on text size?+
The tool runs in your browser and handles documents of several hundred thousand characters quickly. It stops counting after 100,000 matches to keep the page responsive.