Find and Replace

Find and replace text in bulk, with options for case, whole words and regular expressions. See the replacement count as you type. Free and private.

You’ve got a block of text and one thing that needs changing everywhere in it: a misspelt name, an old product code, a set of dates in the wrong format. Do it by hand and you’ll miss one. Do it here and every match changes at once, with a count to tell you how many.

Simple replacing

Paste your text into the first box. Type the word or phrase you want to find in Find, and what you want in its place in Replace with. The result updates as you type, and the number of replacements is shown under it. Leave Replace with empty to delete every match.

By default the search ignores capitalisation, so searching for “cat” also finds “Cat” and “CAT”. The replacement is inserted exactly as you typed it, so you may want to run the case converter afterwards if capitalisation matters. Tick Match case to find only the exact capitalisation.

Whole words only stops you from changing the middle of other words. Replace “cat” with “dog” in “category” and without this option you’d get “dogegory”. Turn it on and only the separate word “cat” is changed.

Regular expressions, without the fear

Regular expressions, usually shortened to regex, are a compact way to describe patterns rather than exact text. Tick Use regular expression and the Find box understands them. You don’t need to learn the whole language. A handful of building blocks solves most everyday jobs:

  • \d+ matches one or more digits, so it finds any number.
  • \s+ matches one or more spaces, tabs or line breaks. Replace it with a single space to collapse whitespace.
  • ^ and $ match the start and end of the text.
  • . matches any single character, and .* matches any run of characters.
  • [aeiou] matches any one letter from the set.
  • (brackets) capture part of the match so you can reuse it.

Captured parts are inserted into the replacement with $1, $2 and so on. For example, to swap “Smith, John” into “John Smith”, find (\w+), (\w+) and replace with $2 $1.

In regex mode, \n in the Replace box inserts a line break and \t inserts a tab, which makes it easy to turn a comma-separated list into one item per line: find , and replace with \n.

Real-world examples

Change date formats. Find (\d{2})/(\d{2})/(\d{4}) and replace with $3-$2-$1 to turn 31/12/2026 into 2026-12-31.

Strip HTML tags quickly. Find <[^>]+> and replace with nothing. It isn’t a replacement for a proper HTML parser, but it’s fine for a quick clean-up.

Remove extra spaces. Find \s{2,} and replace with a single space. The remove line breaks tool also has a button for this.

Add quotes around each word. Find (\w+) and replace with "$1". For wrapping whole lines instead, add text to each line is simpler.

Remove numbers at the start of lines. Find ^\d+\.\s* and replace with nothing. Note that ^ matches the start of the whole text unless your regex flavour treats lines separately, so for line-by-line work you may find it easier to prefix a pattern with \n.

Common mistakes

Forgetting to escape special characters. In regex mode, characters like ., (, ), ?, +, * and [ have special meaning. To match a literal full stop, write \.. If you only want plain text matching, leave regex switched off and the tool escapes everything for you.

Being too greedy. The pattern .* matches as much as it can, which can swallow more than you intended. Use more specific patterns, such as [^>]*, when you can.

Not checking the count. If the replacement count surprises you, adjust the pattern before copying the result.

Before you copy it over

Keep your original text safe until you’re sure the result is right. Replacement can’t be undone once you’ve pasted over your source. Use the count as a sanity check, scan the output, and test on a small sample first if the pattern is complicated.

If your text came from a PDF or an email, line breaks in odd places may make patterns miss. Fix those first with remove line breaks. When you want to count the effect of your changes, the word counter will show before and after totals.

When a specialised tool is quicker

Find and replace can do almost anything, but a few jobs have a faster route. Collapsing spaces is one click in remove extra spaces. Stripping markup is remove HTML tags, and swapping curly quotes for straight ones is the smart quotes converter. To keep or delete whole lines that contain a word, filter lines is simpler than a pattern, and if you want to see what a replacement changed, paste the before and after into the text diff checker.

Frequently asked questions

How do I replace only whole words?

Tick Whole words only. With it on, cat is replaced but category and concatenate are left alone. This option is available when regular expressions are switched off.

How do I use regular expressions?

Tick Use regular expression and type a pattern in the Find box, for example \d+ to match any run of digits. In the Replace box you can use $1, $2 and so on to insert the text matched by each group in brackets.

How do I replace a line break or a tab?

Turn on regular expressions. Use \n to match a line break and \t to match a tab in the Find box. In the Replace box, \n inserts a line break and \t inserts a tab.

Why does it say my pattern is not valid?

Regular expressions have strict syntax. An unclosed bracket or a stray symbol such as a lone opening parenthesis will cause an error. Escape special characters with a backslash, or untick regex to search for them literally.