KKwikfig.

Find and Replace

Find and replace words or patterns across a whole document at once, with match counts, whole-word and case options, plus a full regular-expression mode. Runs entirely in your browser — your numbers never leave this device.

Text
Result
Matches replaced
2

How it works

Count = number of matches of the search pattern in the text | Output = the text with every match replaced by the replacement string | In regex mode the replacement may reference capture groups as $1, $2, …

Enter the text, what to find and what to replace it with, and every occurrence is replaced in one pass — with the match count shown, so you know before you copy the result whether the operation found 2 matches or 2,000. Plain mode treats the search text literally: characters that would be special in a pattern, such as dots and brackets, are escaped for you, so searching for “v1.2” finds exactly “v1.2” and not “v1x2”.

Two switches refine plain mode. Case-sensitive matching is off by default, so “foo” finds Foo, foo and FOO alike; turn it on when case carries meaning, as in product codes. Whole-word mode wraps the search in word boundaries, which is the difference between replacing the animal in “cat” and mangling “category” into “dogegory”. Regular-expression mode removes the training wheels: the search field becomes a JavaScript regular expression, the replacement can reuse captured groups ($2 $1 turns “John Smith” into “Smith John”), and an invalid pattern is reported as an error with no replacement performed, rather than failing silently.

Everything happens in your browser — the document you are editing is never uploaded or stored. For sensitive text such as contracts, manuscripts or exported chat logs, that is the whole point of using a local tool instead of a server-side one.

Worked examples

A plain replace-all with a count

Input
Text: foo bar foo — Find: foo — Replace: baz
Working
Both occurrences of foo match, at the start and the end of the text.
Result
baz bar baz — 2 replacements

Whole-word mode protects longer words

Input
Text: cat category cat — Find: cat — Replace: dog, Whole word = on
Working
Without whole-word mode, the “cat” inside “category” would also match. With it, only the two standalone words match.
Result
dog category dog — 2 replacements

Regex mode swaps a name using capture groups

Input
Text: John Smith — Find (regex): (\w+) (\w+) — Replace: $2 $1
Working
The pattern captures the two words as groups 1 and 2; the replacement writes them back in reverse order. The whole input is a single match.
Result
Smith John — 1 replacement

Frequently asked questions

What is the difference between plain mode and regex mode?

Plain mode searches for the exact characters you typed — a dot means a dot. Regex mode interprets the search field as a regular expression, so a dot means “any character”, \d+ means one or more digits, and parentheses capture groups you can reuse in the replacement as $1, $2 and so on. Use plain mode for words and phrases; use regex mode for patterns like dates, codes or repeated structures.

Why did it replace text inside other words?

Because plain mode matches substrings anywhere: searching for “cat” finds the cat in “category” and “delicate” too. Turn on Whole word to restrict matches to standalone words bounded by spaces or punctuation. Whole-word uses the standard word-boundary rule, so it works for words made of letters, digits and underscores.

Is matching case-sensitive?

Not by default. With case sensitivity off, “foo” replaces Foo, FOO and fOo as well — one search text, three matches. Turn case-sensitive on when the capitalisation matters, for example when replacing a lowercase code in body text but not its uppercase heading version.

What happens if my regular expression is invalid?

The tool reports the error, performs no replacement and returns your original text untouched with a count of zero. An unbalanced bracket such as “(” is the most common cause. Fix the pattern and run it again — your text is never partially edited by a failed pattern.

Can the replacement itself contain a dollar amount like $5?

In plain mode, yes — the replacement is inserted literally apart from regex-mode group references. In regex mode, a $ followed by a number is read as a group reference ($1, $2), so write $$ when you mean a literal dollar sign in regex mode.

Is my document sent anywhere?

No. Find and replace runs entirely in your browser; the text is never uploaded, stored or tracked.

Related tools

More in Text Tools · Browse all tools