Find and Replace

Find and replace text in bulk with optional regular expressions, whole-word matching and case sensitivity — with a preview before anything is changed.

0
Matches replaced
0
Character change

The search box is escaped for you. The replacement box is not.

With the regex checkbox off, everything you type in the search box is escaped before it becomes a pattern — all 14 regex metacharacters — so a full stop means a full stop:

TextFindReplaceResult
a.b.c . - a-b-c
1+1=2 + plus 1 plus 1=2
a[b]c [b] X aXc
a|b | / a/b

The replacement box gets no such treatment. It goes to JavaScript's String.replace, which reserves $ for itself whatever the search side was doing:

You typeIt meansTextYou get
$&$& the whole match, twice hello world hello worldworld
$` everything before the match abc aac
$' everything after the match abc acc
$$ a literal dollar cost $

So replacing "world" with $&$& gives "hello worldworld", not the four characters you typed. $$ is the documented way to get a literal dollar through. It is a small asymmetry with a sharp edge: the box that says literal is literal, and the box next to it is not.

Whole word plus punctuation is a silent no-match

The whole-word option wraps your pattern as \b(?:…)\b. A word boundary sits between a word character and a non-word character, so a \b next to punctuation is asking for something that may not be there. The rule is sharper than "avoid punctuation" — only the edges of the pattern matter, and what sits beside them:

TextFindPlainWhole wordBlocked at
hello! there hello! 1 0 the end
say (x) now (x) 1 0 both ends
a- b a- 1 0 the end
the end. end. 1 0 the end
see #tag #tag 1 0 the start
#tag here #tag 1 0 the start
a "q" b "q" 1 0 both ends
x=1 =1 1 1
a-b c a-b 1 1
say hi hi 1 1

A search fails when a pattern edge is a non-word character and the text character beside it is also non-word, or the string ends there. So a hyphen in the middle is fine and a hyphen on the end is fatal; =1 works because the "x" before it is a real boundary. The rule predicts all 10 cases here.

7 of 10 fail, and they fail quietly — the count reads zero and the text comes back unchanged, which looks identical to "that string is not here". Hashtags, quoted phrases and trailing punctuation are exactly the things people paste into a search box, and exactly what this option breaks.

And two smaller ones

RegexOn "abc"Matches
x*-a-b-c-4
(?:)-a-b-c-4
\b-abc-2

A regex that can match nothing matches at every position, so replacing it inserts between every character: x* turns "abc" into "-a-b-c-". Correct behaviour, and a surprising amount of output.

And case-insensitive replace does not restore case. "Hello hello HELLO" with hello → bye becomes "bye bye bye": three casings in, one casing out. The match is case-blind; the replacement is a fixed string.

How to use

  1. Paste your text and enter what to find.
  2. Enter the replacement.
  3. Turn on regular expressions, whole-word or case matching as needed.
  4. Review the highlighted preview before copying the result.

Frequently asked questions

What does whole-word matching do?

Restricts matches to complete words, so replacing 'cat' does not alter 'category' or 'concatenate'. It is the option people most often need and most often forget, and its absence is the usual cause of a replace that mangles a document.

When should I use a regular expression?

When the thing you are matching varies — a date in any format, a number of any length, a tag with any attributes. For fixed text, a plain search is safer and faster. Reaching for a regular expression to replace a literal string invites trouble from characters it treats as special.

How do I use captured groups in the replacement?

Refer to them by number, conventionally with a dollar sign or a backslash depending on the tool. This lets you rearrange rather than merely substitute — swapping a name from surname-first to given-name-first, for instance, needs two groups and a reordered replacement.

Why did my replacement insert a strange character?

Because the replacement string has its own escape syntax. A dollar sign or backslash in the replacement may be read as a group reference rather than a literal, so inserting a currency amount or a Windows path often needs escaping.

Can I replace across line breaks?

With a regular expression, yes, though the dot does not match a newline by default — you need the appropriate flag or an explicit character class. Plain text search treats the input as one string, so a search containing a newline works if you can enter one.

Is there any way to undo?

Not within the tool, so keep your original. The safe habit is to review the preview before copying anything, and to work on a copy of anything you cannot easily regenerate. A bulk replace on a large document is remarkably good at doing exactly what you asked and not what you meant.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.