🔁 Find & Replace Tool

Replace every occurrence of a word or pattern in a block of text. Use plain text mode for a literal match, or regex mode for pattern-based replacement (supports capture groups like $1).

How the search is built

Both modes end up as one regular expression. Plain text mode escapes every special character first, so what you type is matched literally; regex mode passes your pattern through untouched. The g flag is always on, and the i flag is added unless you tick Case sensitive:

plain text : new RegExp(escaped(find), 'gi')
regex      : new RegExp(find, 'gi')

That default matters. With the sample text - "Hello world. Hello there. The world says hello back." - finding Hello and replacing with Hi reports three replacements, because the lower-case hello at the end matches too. Tick Case sensitive and it drops to two. The count above the output is the number of matches, and the original box is never altered.

Regex mode, and the dollar sign

The replacement field reads dollar patterns in both modes: $& inserts the whole match and $1 the first group, so a replacement meant to contain either of those needs $$& or $$1. A dollar before a digit with no such group, like $5, is left alone.

Frequently asked questions

Is find and replace case sensitive here?

Not by default. The Case sensitive box starts unticked, so Hello, HELLO and hello are all replaced together. Tick it when you are renaming a variable or anything else where capitals carry meaning.

How do I swap two parts of every line?

Switch to regex mode, wrap each part in brackets, and refer to them in the replacement by number. Finding (\w+), (\w+) and replacing with $2 $1 rewrites surname-first names into first-name order.

How do I delete a word instead of replacing it?

Leave the Replace with field empty. Only Find has to be filled in, so an empty replacement removes every match. Put the trailing space inside the pattern to close the gap too.