🔁 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
- Every match is replaced. There is no replace-once option: make the pattern specific enough to hit only the one you want.
- Capture groups work. Find (\w+), (\w+) and replace with $2 $1 turns "Smith, John" into "John Smith".
- The anchors cover the whole text, not each line. There is no multiline flag, so ^ matches only at the very start, and a dot never matches a line break.
- A broken pattern is reported with the browser's own message rather than silently doing nothing.
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.