Find and Replace Text

Swap one word or pattern for another across a whole document.

Text Tools Free, no sign-up Runs in your browser

Find and Replace Text tool

Leave empty to delete every match.

Matching rules
No replacements yet

About the Find and Replace Text

Find and Replace Text does in one step what you would otherwise do dozens of times by hand: locate every occurrence of a word, phrase or pattern in a block of text and swap it for something else. Paste the text, type what you are looking for and what should take its place, and the result appears below with a count of how many replacements were made.

Four switches control how matching works. Case-sensitive matching treats Cat and cat as different. Whole-word matching stops a search for cat from also hitting concatenate. Regular expression mode turns the search box into a pattern, so you can match things like any run of digits or any email address. Replace-first stops after the first hit when you only want to change the opening occurrence.

In regex mode you can use capture groups in the replacement with $1, $2 and so on, which is how you reorder parts of a line. Changing every date from day-month-year to year-month-day across a thousand rows takes one pattern rather than a thousand edits.

How to use the Find and Replace Text

  1. Paste your textDrop in the document, list or code you want to change.
  2. Enter what to find and what to replace it withLeave the replacement box empty to simply delete every match.
  3. Set the matching rulesChoose case sensitivity, whole words, or switch on regular expressions.
  4. Press Replace and copyThe result appears below with a count of how many changes were made.

Features

  • Replaces every occurrence in one pass
  • Case-sensitive and case-insensitive matching
  • Whole-word matching so partial words are left alone
  • Regular expression mode with capture groups in the replacement
  • Replace only the first match when you need to
  • Reports how many replacements were made
  • Clear message when a regular expression is invalid
  • Copy and download the result

Who uses this tool

The find and replace text is used by writers, developers, students, marketers and anyone else who needs the job done once without installing software. Common cases include:

  • Renaming a product, person or brand throughout a document
  • Stripping a repeated prefix from every line of a list
  • Reformatting dates, phone numbers or IDs with a pattern
  • Replacing straight quotes or stray characters in bulk
  • Updating a changed URL across a page of links

Frequently asked questions

How do I delete every occurrence of a word?

Type the word into the find box and leave the replace box empty. Every match is removed and the count tells you how many disappeared.

What does whole-word matching do?

It requires a word boundary on each side of the match, so searching for cat changes the word cat but leaves concatenate and scatter untouched. Without it, any run of matching characters is replaced.

How do capture groups work in regex mode?

Wrap part of your pattern in brackets and refer to it in the replacement as $1 for the first group, $2 for the second and so on. Matching (\d{2})-(\d{2}) and replacing with $2/$1 swaps the two numbers around.

Why does my regular expression report an error?

Usually an unclosed bracket or an unescaped special character. Characters such as a full stop, question mark, plus sign and brackets have meaning in a pattern, so a literal one needs a backslash in front of it.

Is there a limit on how much text I can process?

No fixed limit. Replacement runs in your browser, so very large documents are handled by your device's memory rather than by a server quota.

Does the tool change my original text?

No. The input box keeps what you pasted, so you can adjust the search and run it again from the same source as many times as you like.

If the find and replace text is not quite what you need, these other free tools solve closely related problems.

Text Cleaner

Tidy messy pasted text: extra spaces, empty lines, breaks and special characters.

Text Tools Use tool

Regex Tester

Build and test regular expressions live, with highlighted matches and groups.

Developer Tools Use tool

Remove Duplicate Lines

Deduplicate any list of lines, with case-sensitive and empty-line options.

Text Tools Use tool

Case Converter

Convert any text to UPPERCASE, lowercase, Title Case, Sentence case and more.

Text Tools Use tool