Find and Replace Text

Find and replace every occurrence of a word or phrase at once. The result updates live as you type the search term, with a running count of replacements made. Match case, match whole words only, or switch on regular expressions for pattern-based search and replace.

Find and Replace Text tool

   

How to use it

  1. Paste your text into the box.
  2. Type what to find and what to replace it with.
  3. Turn on Match case, Whole word or Regex if needed, then copy the result.

What is search and replace?

Search and replace scans your text for every occurrence of a term and swaps each one for new text in a single pass. Under the hood, this find and replace tool builds one regular expression from your settings and applies it globally.

whole word: new RegExp("\\b" + escaped(term) + "\\b", "gi")
g = replace all, i = ignore case unless Match case is on

When Regex is off, special characters in your search term are escaped automatically, so searching for 3.5 or (draft) just works. The \b markers are word boundaries: they make the pattern match art but not start or party. Turn Regex on and your own pattern is used as written, including capture groups you can reuse as $1 and $2 in the replacement.

Worked example

Input: Replace ‘cat’ with ‘dog’ in ‘the cat sat’
Result: the dog sat

Mini regex cheat sheet

PatternMatchesExample
\dAny digit 0 to 9\d{4} finds 2026
\wLetter, digit or underscore\w+ finds each whole word
\bA word boundary\bis\b matches is but not this
.Any character except a line breakc.t matches cat, cot and cut
*Zero or more of the previous itemho*p matches hp, hop, hoop
+One or more of the previous item\s+ finds every run of whitespace
?Previous item is optionalcolou?r matches color and colour
( )Captures a group for reusefind (\w+), (\w+), replace $2 $1

Match options explained

By default the tool replaces every occurrence at once and ignores case, so searching for cat changes Cat, CAT and cat alike. The status line reports how many replacements were made, which doubles as a quick way to check how often a term appears. Leave the replace box empty to delete every match.

‘Match case’ makes the search exact, so replacing ‘Apple’ leaves ‘apple’ alone; use it when a word is also a brand or a name. ‘Whole word’ only replaces the term when it stands on its own, so replacing ‘is’ will not change ‘this’ or ‘island’. Skipping that option on a short word is the classic way to corrupt a document with one click.

Using regular expressions

Turn on ‘Regex’ to search by pattern instead of literal text. A few patterns cover most jobs: \d+ matches any run of digits, \s+ matches any run of spaces and tabs, [A-Z]{2,} matches acronyms of two or more capitals, and \bcolou?r\b matches both color and colour. Parentheses capture parts of the match for reuse in the replacement as $1, $2 and so on, and $& inserts the whole match. Find (\w+), (\w+) and replace with $2 $1, for example, turns a list of Last, First names into First Last.

The anchors ^ and $ match the start and end of the whole text, not of each line, and a dot matches any character except a line break. Characters with special meaning in regex (. * + ? ( ) [ ] { } | \ ^ $) need a backslash in front of them. When Regex is off, the tool escapes them for you, so a plain search for ‘3.5’ or ‘(draft)’ just works. An invalid pattern shows an error in the result box instead of failing silently.

Compared with Word and Google Docs

Word, Google Docs, Notepad and VS Code all open find and replace with Ctrl+H on Windows, and all except Notepad support some form of regex. The advantage here is speed for text that lives outside a document: a list from an email, a chunk of HTML, a CSV export. Paste, replace, copy back, with no file to open or save.

Common uses

  • Bulk editing names, terms or URLs
  • Fixing a repeated typo across a document
  • Reformatting data with regular expressions
  • Swapping placeholders for real values
  • Stripping prefixes or tracking parameters from a list of URLs
  • Converting Last, First name lists into First Last

When to use it

  • You need to replace a word in a whole document at once, such as a renamed product across a long page.
  • A pasted article is full of tracking links and you want to delete every URL from the text in one go.
  • A list of names in Last, First format has to become First Last, which one regex swap handles.
  • You want to remove everything in square brackets, footnote markers included, from copied text.
  • The same typo appears dozens of times and fixing it by hand would take longer than one find and replace.

Related tools

Remove Line Breaks has ready-made options for joining lines, so you skip writing a \n pattern yourself.

Remove Extra Spaces collapses messy whitespace in one click instead of a hand-built \s+ replacement.

Slug Generator performs a whole chain of replacements at once, turning any title into a clean URL slug.

Frequently asked questions

Yes, every match is replaced at once and the status line shows how many replacements were made. There is no replace-one-at-a-time mode; if you only want some occurrences changed, narrow the search with ‘Match case’, ‘Whole word’ or a more specific regex pattern.
It only replaces the term when it is a standalone word, so replacing ‘art’ will not affect ‘start’ or ‘party’. Word boundaries fall at spaces and punctuation, so ‘art.’ and ‘(art)’ still match. It is ignored when Regex is on; use \b in the pattern instead.
Yes. Enable Regex to search with patterns such as \d{4} for a four-digit year or ^https?:// for a URL scheme. The search is case-insensitive unless ‘Match case’ is on, and every match is replaced. Invalid patterns show an error in the result box instead of silently doing nothing.
Turn on Regex and search for \n for a line break or \t for a tab. To join all lines with a space, find \n and replace with a single space. For bulk line-break removal with paragraph handling, the remove line breaks tool has ready-made options that need no pattern.
Yes. Leave the Replace with box empty and every match is removed. Combined with Regex this strips whole classes of text: \[[^\]]*\] removes anything in square brackets, \d+ removes every number, and https?://\S+ removes every link.
Wrap part of the pattern in parentheses and refer to it as $1 in the replacement ($2 for the second group). Example: find (\w+), (\w+) and replace with $2 $1 to turn Smith, John into John Smith. $& inserts the entire match, and $$ produces a literal dollar sign.
No. The search and replacement run in your browser using JavaScript's built-in regular expression engine, and nothing is sent to a server. That is also why the result appears instantly as you type, even on very long text.