Bulk find & replace text online
Paste your text, enter what you want to find and what to replace it with, then click "Replace All." The tool supports case-sensitive matching, regular expressions for advanced pattern matching, and whole word matching to avoid partial replacements. It shows the total number of replacements made so you know exactly what changed.
Go deeper
The calculator gives you the number. These SnoopTool guides explain the method, the assumptions and the decision — with worked examples, data tables and FAQs.
Browse all SnoopTool guides →\bcat\b.| Pattern | Matches | Example |
|---|---|---|
. | Any single character except a newline | c.t matches cat, cot, c9t |
\d | Any digit | \d\d\d\d matches 2026 |
\w | Letter, digit or underscore | \w+ matches a whole word |
\s | Any whitespace | \s+ matches a run of spaces or tabs |
\b | A word boundary | \bis\b matches "is" but not "this" |
^ / $ | Start / end of line | ^\s+ matches leading indentation |
* / + / ? | Zero or more / one or more / optional | colou?r matches both spellings |
{2,4} | Between 2 and 4 repeats | \d{4} matches exactly four digits |
[abc] | Any one of those characters | [aeiou] matches any vowel |
[^abc] | Any character except those | [^0-9] matches any non-digit |
(…) | A capture group, reusable in the replacement | see below |
a|b | Either alternative | cat|dog |
.*? | Lazy match — as few characters as possible | essential inside HTML tags |
| Task | Find | Replace with |
|---|---|---|
| Swap "Surname, First" to "First Surname" | (\w+), (\w+) | $2 $1 |
| Convert 2026-09-10 to 10/09/2026 | (\d{4})-(\d{2})-(\d{2}) | $3/$2/$1 |
| Wrap every line in quotes | ^(.+)$ | "$1", |
| Turn a URL into a link | (https?://\S+) | <a href="$1">$1</a> |
| Collapse multiple spaces to one | \s{2,} | a single space |
| Strip trailing whitespace | [ \t]+$ | nothing |
^\s*$\n, replace with nothing (multiline mode on).^\s*\d+\s, replace with nothing.,\s*, replace with \n.[\w.+-]+@[\w-]+\.[\w.]+ and use "find all".(?:\+?91[\s-]?)?[6-9]\d{9} — the leading digit is 6 to 9, never 0 to 5.<[^>]+>, replace with nothing. Fine for a quick clean, unsafe as a security measure.<.*> on a line of HTML swallows everything from the first < to the last >. Use the lazy form <.*?>.\., \+, \?.$1 in JavaScript, VS Code and most editors, but \1 in sed, Vim and Python’s re.sub.Reformat 500 lines of "Sharma, Anjali <anjali@example.com>" into "Anjali Sharma | anjali@example.com"
Find: ^(\w+), (\w+) <([^>]+)>$
Group 1 is the surname, group 2 the first name, group 3 the email.
Replace: $2 $1 | $3
One pass, 500 lines, no manual editing — and the pattern documents itself for the next time the export arrives.
Wrap the term in word boundaries: \bcat\b matches the standalone word cat but not catalogue or bobcat. Most editors also offer a "whole word" checkbox that does the same thing without regex.
Greedy quantifiers such as .* match as much as possible; lazy ones such as .*? match as little as possible. On HTML, greedy matching swallows multiple tags at once, which is almost never what you want.
With $1, $2 and so on in JavaScript, VS Code, Sublime and most GUI editors. sed, Vim and Python’s re.sub use \1, \2 instead. Getting this wrong inserts the literal text rather than the capture.
Enable regex and multiline mode, find ^\s*$\n and replace with nothing. If the file uses Windows line endings you may need ^\s*\r?\n instead.
Yes — VS Code, Sublime, JetBrains IDEs and command-line sed all support it. Always run the search first and read the match count, and make sure the files are in version control before a multi-file replace.
Everything on this page runs in your browser — nothing you type is uploaded or stored.
Short, exact answers to the questions people ask alongside this tool — the number first, then the working.
For teams, not just visitors
We build the calculators on SnoopTool as embeddable widgets in your branding, wired to your own lead form — the same maths, your colours, your domain, your leads. Tell us which one and we will send back a working demo you can put in front of your team.
Thanks — we have it, and you will get a reply from a person within one business day. Meanwhile every tool on SnoopTool stays free, with no signup.