How to use Find and Replace Text
What it does & when you need it
Sometimes you need to swap one string for another across a whole block of text
without opening an editor or writing a sed command. This tool does exactly that:
paste your text, type what to find and what to replace it with, and every match
is swapped instantly. It works in plain-text mode for a straight literal swap, or
in regular-expression mode when you need patterns and capture groups.
It is useful for renaming a variable throughout a snippet, redacting a recurring token, reformatting a list, fixing a repeated typo, or restructuring data with a pattern. Everything happens in your browser, so the text — and whatever you are replacing in it — never leaves your machine.
How to use
- Paste your text into the input buffer, press Sample for an example, or Upload a file.
- Type your search term in Find and the replacement in Replace with. Toggle Regex for pattern matching, Ignore case to match regardless of capitalisation, and Replace all to switch between every match and only the first.
- The output buffer updates live, and its status bar shows how many
replacements were made. Press Copy result or
Ctrl/Cmd+Enter.
Things worth knowing
Literal mode is truly literal. Special regex characters like ., *, and
? are escaped for you, so searching for a.b matches only those three
characters and not "axb". A dollar sign in your replacement stays a dollar sign
rather than being read as a capture reference.
Regex mode unlocks capture groups. Turn on Regex and your search becomes a
JavaScript regular expression. Reference captured groups in the replacement with
$1, $2, and so on — for example, find (\w+)@(\w+) and replace with
$2.$1 to flip the two halves around an at-sign. If the pattern does not compile,
the tool shows the error instead of silently doing nothing.
Matching is case-sensitive by default. Enable Ignore case to add the
regular-expression i flag, so "Foo", "FOO", and "foo" all match the same search.
Working with lists or code? Pair this with the line sorter, the diff checker, or the whitespace cleaner.