The three questions before every replacement
Most find and replace mistakes come from replacing too much. Before you press anything, answer three questions. Should case matter? Searching for apple without Match case also finds Apple and APPLE, which is what you want for a typo but not for a brand name. Should only whole words match? Without Whole word, replacing cat also changes catalog and bobcat. Is this a fixed word or a pattern? A fixed word is plain text; a pattern such as any date or any number needs a regular expression.
The tool on this page shows each change highlighted and counts the matches per rule, so you can see at once whether a rule matched 3 times or 3,000 times. A count that is much higher than expected is the best warning sign.
Try it here: Find and Replace
Open the full tool pageEveryday recipes without regex
Plain text rules cover most daily jobs. Special characters such as the dot, the dollar sign or brackets are treated literally in plain mode, so you do not need to escape anything.
| Task | Find | Replace with | Options |
|---|---|---|---|
| Fix a misspelled word | recieve | receive | Whole word |
| Rename a product everywhere | Model X200 | Model X300 | Match case |
| Change a separator | ; | , | none |
| Remove a word | DRAFT | (empty) | Match case |
| Update a link | http://example.com | https://example.com | none |
Regex recipes for patterns
Turn on Regex for a rule to use regular expressions. Parentheses capture parts of the match, and $1, $2 and so on put them back in the replacement. In this tool \n in the replacement inserts a line break and \t a tab.
| Task | Find (regex) | Replace with |
|---|---|---|
| Collapse repeated spaces | {2,} | (one space) |
| Remove spaces at line ends | [ \t]+(?=\n|$) | (empty) |
| Date 27/10/2026 to 2026-10-27 | (\d{2})/(\d{2})/(\d{4}) | $3-$2-$1 |
| Comma list to one item per line | ,\s* | \n |
| Lines to a comma list | \n | , |
| Swap first and last name | (\p{L}+) (\p{L}+) | $2, $1 |
| Delete empty lines | \n{2,} | \n |
| Remove HTML tags | <[^>]+> | (empty) |
Plain text or regex: which to choose
Start with plain text whenever the text you look for is always the same. It is faster to write, special characters need no escaping and it cannot accidentally match more than you meant. Switch to regex only when the text varies but follows a pattern: any number, any date, any amount of spaces, any word at the start of a line.
A good habit is to build a regex step by step. Write the simplest version, check the highlighted matches, then make it stricter. If you are unsure what a symbol means in a pattern, the regex cheat sheet linked from this page lists the common ones, and the regex tester shows every match with its groups before you replace anything.
Several replacements in the right order
When you need more than one change, order matters. Rules run from top to bottom and each one sees the result of the rules above. Suppose you want to swap two words, red and blue. If the first rule replaces red with blue and the second blue with red, everything ends up red. The fix is a temporary placeholder: red to @@TMP@@, then blue to red, then @@TMP@@ to blue.
Order also matters for cleanup. Remove HTML tags before you collapse spaces, because removing tags often leaves double spaces behind. Normalize line breaks before you join lines. Use the arrows next to each rule to move it up or down, and watch the counts change.
Working with files
Open a text file to load it into the editor; the download keeps its name and extension. To apply the same rules to many files, such as a folder of subtitles, CSV exports or HTML pages, choose Apply to files. Each file is processed with the same rules, you see the number of changes per file, and you download them together as a ZIP. Nothing is uploaded: the files are read and written in your browser.
Only plain text files work this way. Word documents, Excel workbooks and PDF files store text inside a compressed or binary format, so convert them to text first or use the program that created them.
Avoiding the classic mistakes
- Replacing a short word without Whole word, which changes parts of longer words.
- Forgetting that plain mode ignores case by default, which also changes capitalized names.
- Using a regex dot to mean a period: in regex . means any character, so write \. for a real dot.
- Greedy patterns such as <.*> that swallow everything between the first < and the last >. Use <[^>]+> instead.
- Swapping two words with two rules and no placeholder.
- Patterns that can backtrack forever, such as (a+)+b. The tool stops them after two seconds and names the rule.