Find and Replace Text
Replace across a whole document at once, with whole-word matching so you don't turn every 'cat' into part of 'category'.
In short
Use whole-word matching unless you specifically want fragments, or replacing “cat” will also change “category” and “concatenate”. Check the match count before committing. An unexpected number means the pattern is wrong.
Last reviewed
Runs entirely in your browser. Nothing you type here is uploaded, stored or logged.
The option that prevents most accidents
Whole word only is on by default, and it should almost always stay on.
Replacing "cat" with "dog" without it turns "category" into "dogegory", "concatenate" into "condogenate" and "location" into "lodogion". You won't notice until much later, because the words still look roughly word-shaped when you skim.
Turn it off deliberately, when replacing a fragment like a filename extension, a URL stem or part of a compound, not by leaving it off out of habit.
Regular expressions, briefly
Regex matches patterns rather than fixed text. The handful worth knowing:
| Pattern | Matches |
|---|---|
\d | Any digit. \d+ is a run of digits. |
\w | Any letter, digit or underscore. |
\s | Any whitespace. \s{2,} is two or more. |
. | Any single character. |
^ / $ | Start / end of a line. |
[abc] | Any one of a, b or c. |
a|b | Either a or b. |
? | Makes the previous item optional. |
Wrap part of a pattern in brackets to capture it, then reference it in the
replacement as $1. So finding (\w+), (\w+) and replacing with
$2 $1 turns "Smith, John" into "John Smith" across a whole list.
To match a character that has a special meaning, a full stop, bracket or question
mark. Put a backslash before it: \.
Patterns that come up often
| Goal | Find | Replace |
|---|---|---|
| Collapse multiple spaces | \s{2,} | a single space |
| Remove blank lines | \n{2,} | \n |
| Strip trailing spaces | [ \t]+$ | (blank) |
| Remove all digits | \d | (blank) |
| Swap "Last, First" | (\w+), (\w+) | $2 $1 |
| Remove bracketed notes | \([^)]*\) | (blank) |
| Turn commas into new lines | ,\s* | \n |
Check before you commit
The match count updates as you type, and it's the cheapest sanity check available. If you expected to change three names and it reports 47 matches, something is wrong with your pattern. Usually whole-word being off, or a regex being greedier than intended.
Open the preview to see each match in its surrounding text. On a long document that's faster than reading the result and hoping you'd notice a mistake.
Case sensitivity
Off by default, so "London", "london" and "LONDON" all match. Turn it on when case carries meaning, replacing a variable name in code, or changing "US" without touching "us".
Note that the replacement is inserted exactly as typed. Replacing case-insensitively won't preserve the original capitalisation of each match, so a sentence-initial word may need fixing afterwards.
Frequently asked questions
How do I replace every occurrence at once?
Paste your text, type what to find and what to replace it with, and the result updates live with a count of matches. Nothing is changed in place. The original stays in the left box, so you can always compare or start again.
What does "whole word only" do?
Stops partial matches. Searching for "cat" without it also changes "category" and "concatenate". With it on, only the standalone word matches. This is the option that prevents most find-and-replace accidents.
What can I do with regular expressions?
Match patterns rather than fixed strings, \d+ for any run of digits, \s{2,} for two or more spaces, ^ and $ for line starts and ends. In the replacement you can reference captured groups with $1, $2 and so on. An invalid pattern is flagged rather than silently doing nothing.
Can I replace line breaks?
Yes, with regex mode on: use \n for a newline and \t for a tab, in both the find and replace fields. Without regex mode those are treated as the literal characters backslash-n.
Is my text uploaded?
No. Everything runs in your browser, which makes this safe for contracts, client data and unpublished drafts.