Find and Replace

Swap one string for another across a whole block of text, literally or by pattern.

Runs on your deviceTextWorkingNo account needed

What this tool does

Find and Replace reads the text you paste and rewrites every occurrence of one string as another. Two matching modes sit behind the same box: a literal search, which treats what you type as plain characters, and a regular expression search, which compiles your pattern with the browser's own JavaScript engine. The rewritten text appears in a second pane, with a line underneath saying how many matches were changed or that none were found.

Three switches shape a literal match. Case sensitive is off by default, so colour and Colour are both found by the same query. Whole words only skips a match sitting inside a longer word, which is what stops cat from rewriting catalogue. Replace the first match only stops after a single change. The replacement box does a fourth job on its own: leave it empty and each match is deleted instead of swapped, which turns this into a bulk edit for stripping a repeated string out of a document. Ticking the regular expression box adds two more: Multiline mode, on by default, anchors ^ and $ to each line rather than to the whole block, and Dot matches newlines lets a full stop cross a line ending. In that mode the replacement also understands JavaScript's substitution syntax — $1 and $2 insert capture groups,

amp; inserts the whole match, and $ writes a literal dollar sign. Literal mode does none of that: the replacement goes in exactly as typed, so $5.00 stays $5.00.

Four limits are worth knowing before you trust the output. A case-insensitive run does not restore the case it found — replacing colour with color turns Colour into color rather than Color, because the replacement is inserted verbatim. Whole words only behaves differently in the two modes: the literal search counts a letter or digit in any script as part of a word, while the regular expression version wraps your pattern in JavaScript's \b, which recognises only A–Z, 0–9 and underscore, so a word ending in an accented letter will not match there. One character defeats the literal search outright: İ, the Turkish dotted capital I, folds to two characters when the tool lowercases the text for an insensitive comparison, which shifts every position after it by one and hands back the text around a match scrambled — on anything containing that letter, tick Case sensitive or use regular expression mode. And a run takes one Find and one Replace with at a time; your original is left sitting in the input box, but nothing marks up which matches are about to change, and a second substitution means copying the output back over the input by hand.

None of your text leaves the tab. The input is a text box rather than a file picker, the matching and the rewriting happen in this browser, and neither the text nor the settings are transmitted anywhere — which is the practical reason to use it on a contract, a customer export or a config file carrying credentials. The cost is memory: a few megabytes of text is comfortable, and a very large paste will make the tab slow to respond while it works.

How to use it

  1. Paste the text. Type into the input box or press Load sample, which loads three lines carrying colour twice on its own, once hyphenated in colour-blind, and once capitalised inside the longer word Colourful. There is no file picker; this works on text you paste.
  2. Fill in Find and Replace with. Find takes plain characters by default. Leaving Replace with empty is deliberate — every match is deleted rather than swapped. An empty Find box is refused with a message.
  3. Narrow the match. Case sensitive separates Colour from colour, Whole words only keeps cat out of catalogue, and Replace the first match only changes a single occurrence and leaves the rest alone.
  4. Switch to a regular expression when a pattern is needed. Tick Treat “Find” as a regular expression for something like (\d{4})-(\d{2})-(\d{2}), then write $3/$2/$1 in the replacement to reorder the parts. An invalid pattern is reported with the engine's own parse error.
  5. Check the count, then copy. The hint under the output says how many matches were replaced. Reading it before you copy is the quickest way to catch a pattern that matched far more, or far less, than you meant.

Processing & privacy

Runs on your device. Your file is processed directly in this browser.

Common use cases

Renaming an identifier across a file

Whole words only confines the change to the identifier itself, so renaming id leaves width, video and invalid untouched.

Anglicising or Americanising a document

One pass per word swaps colour for color or organise for organize, with case sensitivity off so the capitalised occurrences are caught in the same run.

Reformatting a column of dates

A pattern with three capture groups turns 2024-05-06 into 06/05/2024 down every row of a pasted export, which no literal search can do.

Stripping something repeated

Leave the replacement empty to delete a tracking parameter, a leading prefix or a stray character from every line at once.

Filling in a message template

Paste a draft holding {{name}} and {{date}} and put the real values in, one token per run, before it goes out.

Questions

Is my text uploaded anywhere?
No. The search and the rewrite both happen in this browser tab, so the text is never transmitted and the tool keeps working with the network switched off. There is no file picker either — what you paste into the box goes no further than it.
Why did Colour come back as color rather than Color?
Because the replacement is written exactly as you typed it. Matching can ignore case, but the tool does not read the case of what it found and apply it to what it writes. If you need both forms, run a second, case-sensitive pass for the capitalised one.
Can I replace several different words in one go?
Not in a single run — each run takes one Find and one Replace with. For a series of substitutions, run the tool repeatedly, pasting the previous output back into the input box each time.
Which regular expression syntax works here?
Whatever this browser's JavaScript engine accepts, since the pattern goes straight to the RegExp constructor: character classes, quantifiers, alternation, lookaround and numbered or named capture groups. The u flag is not set, so a Unicode property escape such as \p{L} raises no error and quietly matches the literal characters p{L} instead.
Does it search the text it has just written?
No. Each match is replaced and the scan resumes after it, so a replacement containing the search term does not loop. Replacing and with and then is safe.
Is there a ceiling on how much it will replace?
In regular expression mode a pattern producing more than a million matches is refused rather than run — a guard against a pattern that matches the empty string everywhere. Literal replacement has no such cap, and the real limit is how much text the tab holds comfortably.
What happens when the pattern is wrong?
An invalid regular expression is reported with the browser's own parse message, and an empty Find box is refused, so nothing is quietly returned unchanged. A valid pattern that simply matches nothing reports that no matches were found.

Related tools