Skip to content
Toolew.com

Find and Replace Text

Find and replace words or patterns in text, with match case, whole words, regex capture groups and several rules at once.

Runs in your browser. Your data is not uploaded.
Loading tool…

This guide is not yet available in your language and is shown in English.

Tool guide

What this tool does

Find and Replace Text searches any text for a word, phrase or regular expression and replaces every match, or only the first. You can add a list of extra rules applied in order, see a live replacement count and preview the highlighted matches before copying the result.

Replacing a word throughout a long document is easy in a word processor, but text often lives somewhere else: a CMS field, a CSV export, a chat transcript or a block of code. Plain search-and-replace also falls short when the change depends on a pattern, such as reformatting every date or removing every phone number.

This tool offers both levels. In plain mode your search text is matched literally, with options for case sensitivity and whole words that respect Unicode letters, so “cat” will not match inside “category”. With regular expressions on, it uses the JavaScript regex engine with the Unicode and multiline flags, and replacements can reference capture groups as $1, $2 or $&. The batch box accepts one “find => replace” rule per line, applied in order after the main rule. Processing is local.

How to use Find and Replace Text

  1. Paste or type your text into the Text box, or click Sample.
  2. Enter the search term in Find and the new text in “Replace with”; leave it empty to delete matches.
  3. Set “Match case”, “Whole words only” and “Replace only the first match” as needed.
  4. Turn on “Use regular expressions” for patterns, and use $1, $2 in the replacement for captured groups.
  5. Add further rules in “More rules (one per line)” using the format find => replace.
  6. Check the Replacements count and the highlighted “Matches of the main rule” preview, then copy or download the output.

Tips for better results

  • To swap dates from 2024-03-15 to 15/03/2024, use (\d{4})-(\d{2})-(\d{2}) and the replacement $3/$2/$1 in regex mode.
  • With “Interpret \n and \t” on, finding “\n\n” and replacing it with “\n” removes double line breaks without regex.
  • Batch rules run in sequence, so put the most specific replacements first to stop a general rule changing them.
  • Use “Use output as input” to chain a second pass with different options, such as case-sensitive after case-insensitive.

Common use cases

  • Converting British spellings to American ones (colour to color, organise to organize) in a single pass with batch rules.
  • Redacting email addresses or account numbers from a log before sharing it.
  • Renaming a variable or CSS class across a pasted code snippet with whole-word matching.
  • Normalising quotation marks, dashes or units across a product catalogue export.

Common mistakes to avoid

  • Leaving whole-word matching off when replacing short words, which changes them inside longer words.
  • Using regex special characters such as “.” or “(” in plain mode and expecting pattern behaviour; switch regex on.
  • Writing a pattern that can match an empty string, such as “a*”, which inserts the replacement between every character.

Frequently asked questions

Which regular expression syntax is supported?

The JavaScript (ECMAScript) syntax built into your browser, including lookbehind, named groups and Unicode property escapes such as \p{L}. Patterns run with the global, Unicode and multiline flags, plus case-insensitive unless “Match case” is on.

How do I use a dollar sign in the replacement?

In plain mode a $ is inserted literally. In regex mode $1, $2 and $& are references to captured text, and $$ produces a single literal dollar sign.

How does whole-word matching work with accents?

A match only counts when the characters on either side are not letters, digits or underscores, using Unicode categories. That means “café” is treated as one word and accented letters are not mistaken for boundaries.

Is my text sent to a server?

No. Searching and replacing use your browser’s own engine, so confidential documents and data exports stay on your device.

Related articles

Feedback & suggestions

Help us improve Find and Replace Text. We read every message.

Rating (optional)
Necessary
Required for security, language and theme preferences. Always on.