Find and Replace Text
Find and replace text with case-sensitive, whole-word, and regex options - including capture groups - all in your browser.
- Free, no account
- No watermark
- No usage limit
About the Find and Replace
Find and replace is quietly dangerous, and it's dangerous precisely because it's obedient. Tell it to swap "cat" for "dog" and it will, everywhere, including the "cat" tucked inside "category" and "catalog". You meant to fix one word and you rewrote three. The swap is easy. Knowing how many things you're about to change before it happens is the part that bites you.
That's the whole reason this tool shows a live match count instead of a Replace button. Type in the Find box and the number updates as you go, so you can watch it climb and catch the moment it jumps higher than you pictured, before a single character in your text moves. Most of the free replace-online sites make you paste, hit Replace, and hope the number was right. Here it's in front of you the whole time. It all runs on your own machine too, so a contract, a private export, a client's unpublished copy, none of it goes anywhere. A lot of those free tools quietly ship your text off to their server to do the work. Ours never lets it leave the tab.
How to use
- Paste your text into the Source box at the top. A line or a whole document, both work.
- Type what you're hunting for in the Find field.
- Type what it should become in the Replace with field. Leave it empty to just delete every match.
- Reach for the toggles when you need them. Case-sensitive if capitalization counts, Whole word so "cat" stops matching inside "category", Use regex for pattern matching and capture groups.
- Watch the count. It tells you how many matches were replaced. Glance at that number before you trust the result, if it's higher than you expected your search is catching more than you meant.
- Copy the result, or hit Clear all and start fresh.
There's no Replace button to hunt for. Every edit lands the instant you type, result and count rewriting together, so you see what a search would do while you can still change your mind.
Whole word vs substring
This is the setting that saves you the most grief. By default the tool matches a substring, any run of characters, even buried inside a longer word. Search "cat" in "cat category cats" and you get three hits, not one. Replace it with "dog" and you're left with "dog dogegory dogs", which is almost never what anyone wanted.
Flip on Whole word and the search only matches when your term stands on its own, with a space, some punctuation, or the edge of the text on either side. Same string, one replacement now, and "category" and "cats" stay untouched. This is the toggle for renaming a variable like id without wrecking every width and hidden in the file, or changing a name like "Sam" without mauling "Samuel" and "same".
One detail catches people. A word boundary sits between a word character (a letter, digit, or underscore) and anything that isn't one. So "cat." still counts as a whole word, because the period isn't a word character and the boundary lands right after the t. But "cat5" does not, since the 5 is a word character and there's no boundary between the t and the 5. Keep that in your head the moment your text is full of alphanumeric IDs.
Regex mode and capture groups
Leave regex off and every character you type stays literal. A dot means a dot, a dollar sign means a dollar sign, and the tool escapes the special characters for you in the background so you never have to think about it. Search $5.00 and you find that exact price, not some pattern that matches half your document.
Turn Use regex on and those same characters wake up. Now . means any character, * means zero or more of the thing before it, and ^ and $ anchor to the start and end of your text. The Find field becomes a real JavaScript regular expression, with character classes (\d, \w, \s), quantifiers, anchors, and the feature that makes the whole mode worth turning on, capture groups.
Wrap part of your pattern in parentheses and you capture whatever it matched. Then in the Replace field you paste those pieces back with $1, $2, and so on, numbered by their opening bracket. One example does more than a paragraph here. Say you want to flip a@b into b.a:
Pattern: (\w+)@(\w+)
Replacement: $2.$1
The first group grabs a, the second grabs b, and the replacement drops them back in the other order with a literal dot between. Scale that up and you can flip Last, First names into First Last, or wrap every word in brackets by searching \w+ and replacing with [$&]. That $& stands in for the whole match, and if you ever need a real dollar sign in the output, type $$ and it comes out as one $.
This is exactly where the live count pays off again. A too-greedy regex shows up instantly as a count that's way too high, so you catch it while it's still just a preview.
When your pattern won't compile
Type a lone ( or a stray bracket and JavaScript can't build a valid pattern from it. Instead of crashing, or worse, silently doing something strange to your text, the tool drops a small inline "Invalid regular expression" note and leaves your source untouched. Fix the pattern and the error clears on its own.
Most invalid-regex errors come down to three things: an unbalanced bracket or paren (every ( needs its )), a quantifier like * or + with nothing in front of it, or a lone backslash at the end with nothing left to escape. When a pattern won't behave, build it up one piece at a time and keep half an eye on the count. A search that suddenly matches everything or nothing is usually a .* that ran away.
Two honest limits. It works on plain text, so it won't keep your bold, fonts, or headings, if you need the change written straight back into a formatted document with an undo history, your word processor's own replace is the better pick. And for rewriting one string across hundreds of files at once, a command-line tool like sed is the right fit, though it gives you no preview. For a single block of text you want changed fast and kept private, this is hard to beat.
Frequently asked questions
Does my text get uploaded or saved anywhere?
No. Every keystroke is processed right on your device, with no network calls, so it even works with your connection off. Nothing is sent, stored, or logged, and closing the tab wipes it. That's what makes it safe for confidential drafts or anything you'd rather not hand to a stranger's server.
Why isn't my search finding anything at all?
Usually one of three invisible mismatches. Case-sensitive might be on while your casing differs, so try turning it off. In regex mode a special character may not mean what you think, a literal dot needs to be \.. Or the text hides something you can't see, a tab where you typed spaces, or a curly "smart" quote pasted from a document that doesn't match the straight quote in your Find box. Copy the exact text from the source into Find to rule that out.
Can it keep the original capitalization when it replaces?
Not automatically. Case-insensitive matching applies to the find, not the replace, so if you search color loosely and swap in colour, a sentence-starting Color comes out lowercase. The tool pastes your replacement exactly as typed. For changes that need to respect capitalization, do the replace here first, then run the output through a case converter.
Do ^ and $ match each line or the whole text?
The whole text. There's no multiline flag turned on, so ^ anchors to the very start of everything in the Source box and $ to the very end, not to each line break. The . character won't cross a newline either. If you need to match an actual line break, put \n or \s in your pattern instead of relying on ..
Is there a size limit on the text?
No fixed cap. Everything runs in your browser, so the real limit is your device's memory. Normal documents replace instantly. Only a genuinely huge block (hundreds of thousands of words) or a heavily backtracking regex will make the tab pause while it works. If you hit that, split the text into chunks or simplify the pattern.
Can I undo a replace after I've made it?
There's no undo history, the tool rewrites the result live rather than tracking steps. That's why the match count matters, it's your check while you can still back out. If a replace went wrong, clear the Find box and the result returns to your untouched source.
Can I delete text instead of swapping it?
Yes. Leave the Replace with field empty and every match gets removed. It's the quickest way to strip a repeated header, a watermark line, or leftover markup out of pasted text, find the thing, replace it with nothing.