Find and Replace swaps one piece of text for another across everything you paste in, and counts the matches so you can see how much it changed. There are three switches worth knowing about: match case, whole words only, and regular expressions. With patterns turned on you can capture part of a match and reuse it in the replacement with $1, $2 and so on, which handles jobs like flipping "John Smith" into "Smith, John".
How to use it
- Paste your text into the main box.
- Type the text to look for and what should replace it. Leave the replacement empty to delete every match.
- Tick whole words if you don't want "cat" to match inside "category", and the regex option if you're matching a pattern rather than a literal string.
- Check the match count, then copy the updated text.
When it helps
- Renaming a product, person or term throughout a long draft.
- Cleaning data, for example swapping semicolons for commas before an import.
- Reformatting names or dates with a pattern and capture groups.
- Stripping out a phrase or tag that appears dozens of times.
Good to know
- With regex on, characters like . and * are operators. If you're searching for a literal full stop, turn regex off or escape it with a backslash.
- A pattern that can't be parsed shows a message instead of changing anything, so you can't wreck your text with a typo.
- Try the pattern on a small sample first if the text is long; the match count tells you quickly when something is too greedy.
How matching works
By default the tool treats what you type in the Find box as plain text. Every special character, including the full stop and the asterisk, is taken literally. That makes it safe for ordinary editing jobs such as changing a company name throughout a document. With whole words only ticked, a match must begin and end at a word boundary, so replacing "art" will leave "party" alone.
Switching on regular expressions changes the meaning of the Find box. Now a full stop means "any character", \d means "any digit", and brackets create groups you can reuse as $1, $2 and so on in the replacement. This is powerful, and it's also where most mistakes happen, so check the match count after each change.
Worked example: reversing names
Suppose your text has lines such as John Smith and Amina Bello and you want them as Smith, John and Bello, Amina. Tick the regular expression option, type (\w+) (\w+) in Find and $2, $1 in Replace with. The first group captures the first name, the second group captures the surname, and the replacement puts them in the opposite order with a comma between.
A second common job is cleaning up spacing. Searching for two spaces in a row and replacing them with one tidies most typing slips, and running it twice handles longer runs. Searching for a full stop followed by a capital letter, with a regular expression, can help you find where a space is missing after a sentence.
Mistakes to avoid
The most common mistake is forgetting that regular expression mode is on and then searching for something like 3.5. In that mode the full stop matches any character, so "305" and "3x5" match as well. Turn the option off, or write 3\.5, when you want a literal full stop.
The second is replacing too much. A short find string such as "he" matches inside "the", "when" and "other". Use whole words, or add enough context to make the match unique, and look at the count before copying the result. If the count is far larger than you expected, you've matched something you didn't mean to.
Questions
How do I reuse part of what was matched?
Put that part in brackets in the Find box, then write $1 for the first bracketed group, $2 for the second, and so on in the replacement.
Does my text leave the browser?
No, the matching happens locally.