AnyTool
Your files never leave your device. All processing happens locally in your browser.

How do I find and replace text online?

Paste your text into AnyTool Find and Replace, type what to find and what to replace it with, and the result updates instantly. Each rule can use plain text or a regular expression, match case, match whole words only, replace all or just the first match, and preserve the original casing. You can stack several rules that run in order. Everything happens in your browser, so your text is never uploaded.

  • Plain-text or regular-expression matching, live as you type
  • Case-sensitive, whole-word, replace-all-or-first and case-preserving options
  • Capture-group references ($1, $<name>) and escape sequences (\n, \t)
  • Multiple ordered rules you can enable, disable, reorder or remove
  • Match highlighting, a match list and a friendly error for invalid regex

What is

Find and Replace

Find and replace is a text operation that locates every occurrence of a search term — a literal string or a regular-expression pattern — and substitutes it with replacement text, optionally honouring case, word boundaries and capture groups across a whole document at once.

Text Tools

Related terms

Regular ExpressionCapture GroupCase-Sensitive SearchSubstitute Text

Frequently Asked Questions

No upload happens. All matching and replacing runs in your browser, so your text never leaves your device and the tool works offline.

Every replacement is computed locally in your browser with JavaScript. Nothing is sent to a server, there is no tracking, and the page works offline after the first load — so you can safely run find and replace on confidential drafts, logs or code.

Turn on the Regex option for a rule, type a pattern in Find, and reference capture groups like $1 or $<name> in Replace.

Enable the Regex toggle on any rule and the Find box is treated as a JavaScript regular expression. You can add flags for case-insensitive matching, multiline anchors (^ and $ per line) and dotAll (so a dot matches newlines), then reference captured groups in the replacement with $1, $2 or named groups like $<year>. The match preview highlights what the pattern catches as you type.

Yes. Add several rules and they are applied in order, top to bottom, each transforming the output of the one before it.

The tool supports a stack of find and replace rules. Each rule has its own find, replace and options, and you can enable, disable, reorder or remove any of them. Rules run in sequence, so you can chain transformations — for example normalise spelling first, then reformat phone numbers with a regex rule.

It matches the capitalisation of each found word, so replacing begin with end turns Begin into End and BEGIN into END.

With Preserve case enabled, the replacement adopts the casing pattern of the text it replaces: an all-uppercase match yields an uppercase replacement, an all-lowercase match yields lowercase, and a Capitalised match keeps the first letter capitalised. It is ideal for renaming terms throughout a document without breaking sentence case.

Detailed Explanation

Methodology

How Find and Replace Works

AnyTool Find and Replace runs entirely in the browser. Each rule is compiled to a JavaScript RegExp: plain-text rules escape regex metacharacters (and optionally wrap the term in word boundaries), while regex rules use your pattern verbatim with the flags you choose. Rules are applied in order, each one transforming the output of the previous rule, and the replacement supports capture-group references and decoded escape sequences. The result is recomputed live as you type or edit a rule.

  • Plain-text find is regex-escaped; whole-word wraps it in \b…\b
  • Flags map to options: i (ignore case), m (multiline ^$), s (dotAll), g (replace all)
  • Replacement supports $&, $1…$99 and named groups $<name>
  • Escape sequences \n, \t, \xNN and \u{…} are decoded in the replacement
  • All computation is client-side JavaScript — no server round-trip
How It Works

ReDoS-Safe Regex and Live Highlighting

A pathological pattern such as (a+)+$ can hang a regular-expression engine for seconds on adversarial input. To prevent the tab from freezing, the user pattern that drives the live match highlight runs inside a throw-away Web Worker that the page terminates after a hard timeout. The first active rule’s matches are highlighted in the input, capture groups are colour-coded, and a match list shows each hit with its position. An invalid pattern shows a friendly inline error instead of breaking the page.

  • User regex executes in an isolated Web Worker with a hard timeout
  • A catastrophic pattern is stopped rather than freezing the tab
  • Matches and capture groups are highlighted directly in the input
  • A match list shows each hit and its character offset
  • Invalid regex produces a clear inline error, never a crash
Privacy & Security

Privacy and Offline Use

Because all matching and replacing happens in the browser, the text never reaches a server, there is no account or tracking, and the page works offline after first load. Multiple rules can be stacked, reordered and toggled, a case-preserving mode keeps the original capitalisation of each match, and large inputs are debounced so the editor stays responsive.

Find and replace: in-browser (AnyTool) vs typical online replacers
CapabilityAnyToolTypical online replacers
Text handlingProcessed in your browserOften posted to a server
PrivacyText never leaves deviceMay log or store submitted text
Multiple ordered rulesYes, enable/reorder/removeOften a single pair
Regex with capture groups$1…$99 and $<name>Sometimes basic or absent
Case-preserving replaceYesRarely offered
Catastrophic-regex safetyWorker timeout, no freezeTab can hang
Works offlineYes (PWA)No
Cost / signupFree, no signupOften ad-heavy or gated

Server-based replacers can retain pasted text in logs; AnyTool runs every rule locally and uploads nothing.