Do the find before the replace. Type what you are looking for, read the list of matches, and only then decide what goes in their place — almost every replace-all disaster is somebody who skipped that step. The rest is mechanical: narrow the pattern until only the hits you meant are left, keep the original text somewhere you can get it back from, and afterwards check that the character count moved by roughly the amount you predicted.
What should I check before I replace anything?
The match count, and then the matches themselves. A replace-all is a single decision applied to every hit at once, and the match list is where you see those hits before you make it.
That is the part worth using in the find and replace tool here: every match is listed with its line and column number and the text on either side of it, updated as you type, while the edited version goes into a separate read-only box. The text you pasted sits untouched in the input box until you press Use result as input, so overwriting the original is one deliberate click rather than a side effect of typing. The list itself stops at the first 100 matches; the counter keeps going past that. If it says 4,000 and you were expecting 40, stop and fix the pattern.
Why did it replace more than I asked?
Your word lives inside other words
Replacing cat with dog also edits category, concatenate and vacation. This is the single most common way a replace-all goes wrong, and it is invisible in a long document because the damage is spread across words you never thought about.
Whole words only wraps your pattern in a word boundary and handles the ordinary case. Know its limit before you trust it: the boundary only counts A–Z, digits and the underscore as word characters. Searching for café as a whole word misses every normal occurrence, because é is not a word character and a space or a full stop after it is not one either, so there is no boundary between them. Perversely, the same pattern does match inside cafés, where the s supplies the boundary the space could not. Hyphens fail in the other direction — up as a whole word still matches inside follow-up, since the hyphen reads as a separator. For accented words, apostrophes or anything outside plain ASCII, turn the option off and put the surrounding context into the search term yourself.
Ignoring case throws the capitals away
Tick Ignore case to catch Color, color and COLOR in one pass, and all three come out as exactly what you typed in the Replace box. The capital at the start of a sentence is gone and nothing warns you. There is no case-preserving replace here, and no way to uppercase a capture group either — GNU sed has \U for that, JavaScript replacement strings have no equivalent, and this tool is JavaScript. When case matters, run two passes with Ignore case off: one for the lowercase form, one for the capitalised one.
Why can it not find a word that is plainly there?
Because what is on screen is not what is in the text. Four regular culprits:
- Curly quotes. Word and most CMS editors autocorrect ' into ’ as you type, so pasted text has the curly one where you typed the straight one. Different characters, and neither finds the other.
- Non-breaking spaces. U+00A0 looks exactly like an ordinary space on screen and does not match one.
- A trailing space inside your search term, collected when you copied the word out of the document to paste into the Find box.
- A line break in the middle of the phrase, because the text was hard-wrapped rather than soft-wrapped.
The first two are the ones that eat the hour, because there is nothing to see. The invisible characters breaking your text covers where they come from and how to make them visible. For the line break, leave Read \n and \t as escapes ticked and type \n in the Find box: a single-line input cannot hold a real newline, so the escape sequence is the only way to ask for one.
How do I swap two words without losing both?
You want every Alice to become Bob and every Bob to become Alice. Run the two replacements one after the other and you end up with a document full of Alices. The first pass turns all the Alices into Bobs; the second turns everything called Bob — the originals and the ones you just created — into Alice.
The fix is a placeholder nobody would ever type. Replace Alice with @@SWAP@@, then Bob with Alice, then @@SWAP@@ with Bob. Three passes, no collision. The same trap catches any sequence where the output of one replacement is the input of a later one, which is most "tidy up the terminology" jobs and every rename that touches two similar names.
Within a single pass you are safe: the text is walked once and the result is written somewhere else, so replacing a with aa finishes instead of looping forever. It is chained passes that feed one replacement back into the next search.
What goes wrong once you turn on regex?
Plain mode escapes every character a regex engine would treat as an instruction, so price (USD) looks for exactly that. Tick Regular expression and the escaping stops. Three things bite immediately:
- A pattern that can match nothing will match everywhere.
\s*succeeds on the empty string, so it fires between every pair of characters and your replacement is inserted across the whole document. If the match count is suspiciously close to the character count, that is what happened. - The dot does not cross lines.
.matches any character except a newline, so a pattern meant to span two lines quietly matches nothing. Use[\s\S], which means "whitespace or not whitespace" and therefore everything. - The dollar sign is an instruction in the Replace box.
$&inserts the whole match, always.$1inserts capture group 1, but only if the pattern actually has one: replace with$100and a pattern with no parentheses leaves you a literal$100, while the same replacement against(\d+)gives you the digits it captured followed by two zeroes. So the bug only appears once you start using groups, which is exactly when you have stopped watching for it. Write$$for a literal dollar. Plain mode does that doubling for you; regex mode deliberately does not.
One more, rarer but worse: nested repetition such as (a+)+b can take exponential time on the wrong input. The tab stops responding and the only way out is to close it, losing whatever was in the box. Nothing is stored and nothing is uploaded, which is the privacy upside and the recovery downside at the same time.
How do I check what actually changed?
Predict the number before you look at it. The tool shows characters before and characters after, so if you are replacing a 5-character word with a 7-character one across 12 matches, the count should rise by exactly 24. When it does not, the gap is the diagnosis: too large and your pattern is catching more than you think, too small and some of the matches were a variant you did not account for.
For anything longer than a screen, read the change rather than the number. Paste the original into one side of a diff checker and the result into the other, and every altered line is marked. This takes about a minute and is the only step that catches a replacement that was technically correct everywhere and wrong in one place — the sentence where your term appeared as part of a longer name, or the code block you did not mean to touch. Comparing two versions of a text goes through reading a diff properly, including why whitespace-only changes swamp everything else.
Can I get the original text back?
Only if you kept a copy. This tool has no undo, and neither does a script that has already written the files, and neither does the editor you closed without saving. The result box is regenerated from scratch on every keystroke, so the input is safe until you overwrite it — but once you have pressed Use result as input, the previous version exists nowhere.
So before a replacement you are not certain about, put the original somewhere else: a second tab, a scratch file, a commit. It costs five seconds and it is the difference between a wrong pattern being an annoyance and a wrong pattern being an afternoon of retyping.
The find and replace tool runs entirely in your browser, which is why the match list appears while you type and why nothing you paste into it leaves your machine; use that list, not the Replace box, to decide whether the pattern is right. The habit worth adding around it is parking the original text somewhere before you overwrite it. Taking notes without an account covers browser-only scratch space for exactly that — somewhere to drop a copy without creating a document or signing into anything.
Frequently asked questions
How do I find and replace text safely?
Search first and read the list of matches before typing anything into the replace field. Narrow the pattern until the match count is the number you expected, keep a copy of the original text elsewhere, then replace and confirm the character count moved by the amount you predicted.
How do I replace a word without matching it inside other words?
Turn on "whole words only", which requires a word boundary either side of your term so that "cat" no longer matches inside "category". The boundary only recognises A–Z, digits and the underscore as word characters, so a term ending in an accented letter, like "café", finds nothing when a space or a full stop follows it. For those, turn the option off and include the surrounding spaces or punctuation in the search term instead.
Why can I not find a word that is definitely in the text?
Usually because the characters are not the ones you typed. Curly apostrophes from Word do not match straight ones, and a non-breaking space looks identical to a normal space but is a different character. A trailing space copied into the search box and a hard line break inside the phrase cause the same silent failure.
Can I undo a find and replace?
Not in a browser tool that keeps no history, and not in a script that has already written the files. Browser-based tools typically show the result in a separate box, so the original survives until you deliberately overwrite it. Copy the original somewhere else before any replacement you are unsure about.
How do I swap two words with find and replace?
Use three passes and a placeholder, not two passes. Replace the first word with a token nobody would type, replace the second word with the first, then replace the token with the second. Doing it in two passes turns every instance of both words into the same word.
Last updated September 19, 2026