HomeText & Developer Tools › Find and Replace

Find and Replace

Find and replace text online with match case, whole word, multiline and regular expression options, capture groups like $1, and a live count of replacements.

     

Plain, whole-word and case-sensitive matching

By default the Find box is treated as literal text: characters like ., $ and ( mean themselves, and matching ignores case, so order finds Order and ORDER. Check Match case to distinguish them. Whole word wraps your search in word boundaries (\b) so cat no longer matches inside category; boundaries fall between a letter, digit or underscore and anything else, which means it does not help with punctuation-only searches. In plain mode the Replace box is also literal - a $ there is written as-is, so replacing USD with $ works without escaping.

The result shows how many matches were replaced and the full updated text, updating live as you type. With the sample text and defaults, Order matches twice and both become Invoice.

Regular expression mode

Check Regular expression and the Find box is compiled as a JavaScript regex with the global flag, plus i unless Match case is on and m when Multiline is on. In multiline mode ^ and $ anchor to the start and end of each line rather than the whole text, which is what you usually want for line-by-line cleanup. Parentheses create capture groups that you reference in the Replace box as $1, $2 and so on; $& inserts the whole match, $$ a literal dollar sign, and $<name> a named group. Write \n or \t in the Replace box to insert a line break or tab.

Useful patterns: \d+ is a run of digits, \s+ is whitespace, \w+ is a word, . is any character except a newline, [A-Z] a character class, ? makes the previous item optional, * means zero or more and + one or more. To match a literal period, plus sign or parenthesis in regex mode, escape it with a backslash: \., \+, \(. Quantifiers are greedy - <.*> swallows everything between the first < and the last > on a line; add a question mark, <.*?>, for the shortest match.

Recipes you can paste

Reformat the sample dates from ISO to US style: find (\d{4})-(\d{2})-(\d{2}), replace with $2/$3/$1 - 2026-09-01 becomes 09/01/2026. Mask emails: find (\w)[\w.+-]*@, replace with $1***@. Strip the amounts: find \$\d+\.\d{2}, replace with [amount]. Trim trailing spaces on every line: find [ \t]+$ with an empty replacement. Collapse blank lines: find \n{3,}, replace with \n\n. Turn a comma-separated list into lines: find ,\s*, replace with \n. Remove HTML tags: find <[^>]+>, replace with nothing.

All processing runs in your browser; nothing is uploaded. If a replacement count of 0 surprises you, check for Match case, an extra space in the Find box, or a special character that needs escaping in regex mode.

Frequently asked questions

Why does it say 0 matches?

Usually Match case is on and the case differs, or there is a leading or trailing space in the Find box, or you are in regex mode and a . + ( ) or $ in the pattern changed its meaning. Try turning off Regular expression to search literally.

How do I replace line breaks with commas (or the reverse)?

Check Regular expression. To join lines, find \n and replace with a comma and a space. To split, find , ? (comma, optional space) and replace with \n - the tool converts \n in the Replace box into a real line break in regex mode.

What does $1 mean?

It inserts the text captured by the first pair of parentheses in your regex. With find (\d+) dollars and replace $$$1, the text 120 dollars becomes $120. Use $2, $3 for later groups and $& for the whole match.

Can I use this on Word or Excel content?

Yes - paste the text here, replace, and paste it back. Plain text survives the round trip; bold, fonts and cell formatting do not, so for formatted documents use the application's own Find and Replace.