Skip to content
Everyday Utilities Free • No signup • Instant results

Find and Replace Text

Replace text or regex matches instantly across large documents.

About the Find and Replace Text

Find and Replace is the Swiss-army knife of text editing. Unlike the basic find-and-replace built into your text editor, this tool supports plain text matching, case-insensitive matching, whole-word-only matching, and full regular expression replacement — with a counter showing exactly how many substitutions were made. Paste your text, configure the options, and get an instant preview of the result with a copy button.

The whole-word mode is the difference between replacing “fox” in “The quick brown fox” (a hit) and accidentally turning “foxes” into “cates.” Regular expression mode unlocks powerful transformations: convert date formats, redact phone numbers, normalize whitespace, swap delimiters, or extract structured data from free text. Both modes report the match count so you can verify the replacement did what you expected.

Because everything runs in your browser, you can safely use this tool on sensitive drafts — legal contracts with redactions, internal reports with placeholder names, code with confidential API keys — without worrying about server-side logging.

How It Works

In plain-text mode, the tool escapes regex metacharacters in your search term using /[.*+?^${}()|[\]\\]/g so a search for “$5.00” matches literally rather than as a regex. Whole-word mode wraps the pattern in \b word boundaries so “fox” matches the standalone word but not “foxes” or “foxtail.” Case-insensitive mode adds the i flag to the regex.

In regex mode, the search term is passed directly to new RegExp(pattern, flags) with the global flag set so all matches are replaced. The replacement string supports standard regex replacement syntax including $1, $2 for capture groups and $& for the matched substring. If your pattern is invalid (unbalanced parentheses, malformed character classes), the tool catches the syntax error and shows a message rather than crashing.

The replacement counter works by passing a function as the second argument to String.replace. The function increments a counter on each invocation and returns the replacement string. This is more reliable than comparing input and output lengths, which would miscount if a replacement string is the same length as the search term.

Worked Examples

Default input “The quick brown fox. The fox is quick. Foxes are clever.” with search “fox” and replacement “cat” in plain-text mode makes 2 replacements (the standalone “fox” on line 1 and the “fox” on line 2), leaving “Foxes” untouched. Toggle case-insensitive and the count stays at 2 because “Foxes” contains “fox” only as a substring (which plain mode still matches as part of the word).

Now toggle whole-word mode and case-insensitive, and the same search matches only standalone “fox” or “Fox” — “Foxes” is excluded because of the word boundary. This is the safest way to replace a name without affecting derived words.

For a regex example, switch to regex mode and search for \b\w{4}\b with replacement [XXXX]. This redacts every four-letter word. Use (\w+)@(\w+\.\w+) as the pattern and $1 [at] $2 as the replacement to obfuscate email addresses in a document — a common need before sharing drafts externally.

When to Use This Tool

  • Bulk-renaming a character or product name throughout a manuscript.
  • Redacting phone numbers, emails, or Social Security numbers before sharing a document.
  • Converting date formats (e.g., MM/DD/YYYY to YYYY-MM-DD) using regex capture groups.
  • Normalizing whitespace by collapsing multiple spaces or tabs into a single space.
  • Replacing British spellings with American ones (or vice versa) across a document.
  • Stripping HTML tags from copied content before pasting into a plain-text editor.
  • Swapping delimiters in CSV-like data (commas to tabs, semicolons to pipes).

Limitations & Disclaimer

This tool performs single-pass replacement and does not support conditional logic, multi-step macros, or saved replacement dictionaries. Regex mode uses JavaScript's regex engine, which does not support lookbehind in older browsers (Safari prior to 16.4) and may behave differently from PCRE or Python regex in edge cases like recursion or named backreferences. Very large inputs (over ~1MB) may cause UI lag during replacement. The tool does not preserve undo history — always keep your original text elsewhere. See our disclaimer for full terms.

Frequently Asked Questions

Can I use capture groups like $1 in the replacement?

Yes, but only in regex mode. In regex mode, <code>$1</code>, <code>$2</code>, etc. refer to capture groups in your pattern, and <code>$&</code> refers to the entire matched substring. In plain-text mode, the replacement is treated as a literal string with no special meaning for the dollar sign.

What is the difference between plain and regex mode?

Plain mode treats your search term as literal text (escaping regex metacharacters like $ and * for you). Regex mode passes your search term directly to the regex engine, enabling patterns like <code>\d+</code> (any digits) or <code>[A-Z]{3}</code> (three uppercase letters). Use regex mode only when you specifically need pattern matching.

Does whole-word mode work with regex?

No. Whole-word mode wraps the pattern in <code>\b</code> word boundaries, which only makes sense for literal text. If you need word boundaries in regex mode, include <code>\b</code> in your pattern directly. The tool shows an error if you try to combine both options.

What happens if my regex is invalid?

The tool catches the syntax error and shows a message like &ldquo;Invalid regex: Unexpected end of input.&rdquo; No replacement is performed. This prevents the page from crashing and lets you fix the pattern.

Can I undo a replacement?

No &mdash; the tool operates on the input you paste and produces a new output. Your original input remains in the input field unchanged, so you can compare the two. If you want to keep the original, copy the output to a separate location rather than overwriting your source.

Is my text sent to a server?

No. All search and replacement happens in your browser using JavaScript. Your text &mdash; including any sensitive content like API keys, passwords, or confidential drafts &mdash; never leaves your device.

Last updated: July 21, 2026  ·  Author: HT99 Tools Editorial Team  ·  Reviewed by: HT99 Tools Editorial Team