Text Replacer

misc
Loading feedback…

Find and replace text with multiple rules in one pass. Each rule supports literal or regex matching, case sensitivity, and whole-word mode, with live match counts and a color-coded preview of what will change before you copy the result.

Last updated: July 4, 2026Author: Mateo DíazReviewed by: Riley Williams
Find and Replace Text
In-browser
Stack multiple find/replace rules and watch matches update live
Replacement RulesRules run top to bottom

Match Preview

No matches yet. Fill in a Find field above and matches light up here.

Result

What this tool does

A text replacer finds a string in your text and swaps every occurrence for something else. That part is table stakes. This one also stacks multiple find/replace rules in a single pass, counts matches live as you type, and highlights exactly what will change before you copy anything. If you have ever run the same text through a basic replacer three times in a row to fill three placeholders, the rule stack is for you.

Need to find and replace text directly on a live web page? Use the Text Replacer for Chrome extension instead.

What makes this replacer different

  • Stackable rules. Add as many find/replace pairs as you need. They run top to bottom in one pass. Most competing tools give you one field and make you re-run the output through the tool for each additional change.
  • Live match counts per rule. Each rule shows how many matches it found before you commit. A rule showing "0 matches" tells you about a typo in the Find field immediately, not after you have pasted the "result" somewhere.
  • Color-coded match preview. Matches light up in your input text, one color per rule, so you can see what is about to change and catch accidental hits like "cat" inside "category".
  • Regex without a separate tool. Regular expressions, capture groups, and whole-word matching are toggles on each rule, not a different page.
  • Correct dollar-sign handling. In literal mode, replacing text with $5 inserts $5. A surprising number of online replacers pass the replacement straight to JavaScript's replace() and silently mangle it.
  • Private by design. Everything runs in your browser. Nothing is uploaded.

How to use it

  1. Paste your text into the input box.
  2. Fill in a rule: what to find, what to replace it with. Leave Replace empty to delete matches.
  3. Toggle options per rule if needed: Aa for case-sensitive, .* for regex, |w| for whole words only.
  4. Check the match counts and preview. Every rule shows its match count, and the preview highlights each match in your input.
  5. Add more rules if one pass isn't enough. Rules apply in order, top to bottom.
  6. Copy or download the result.

Copy-paste recipes

These are the replacements I actually reach for. Each one is a single rule unless noted. Patterns marked regex need the .* toggle on.

TaskFindReplace withMode
Remove all URLshttps?:\/\/\S+(empty)regex
Strip trailing spaces from every line +$(empty)regex
Delete empty lines\n{2,}\nregex
Collapse multiple spaces into one {2,} (one space)regex
Straighten curly double quotes[“”]"regex
Straighten curly apostrophes[‘’]'regex
Swap US dates for ISO (04/07/2026 to 2026-07-04)(\d{2})/(\d{2})/(\d{4})$3-$2-$1regex
CSV commas to semicolons,;literal
Tabs to commas (TSV to CSV)\t,regex
Wrap every line in quotes^(.+)$"$1"regex
Add a prefix to every line^> regex
Remove Markdown bold markers\*\*(empty)regex

The date-swap recipe is the one I show people who think they don't need regex. Three capture groups, one rule, and a whole spreadsheet column of dates changes format at once.

Regex quick reference

Enough regex to cover 90% of replacement jobs:

PatternMatches
\dany digit (\d+ for one or more)
\wletter, digit, or underscore
\sany whitespace, including tabs and newlines
.any single character except newline
[abc]one character from the set
[^abc]one character not in the set
^ and $start and end of each line (this tool always uses multiline mode)
\bword boundary, or use the `
a{2,4}between two and four as
`(onetwo)`
\. \( \$a literal dot, parenthesis, or dollar sign

In the replacement field: $1, $2 insert capture groups, $& inserts the entire match, and $$ gives a literal dollar sign (regex mode only; literal mode needs no escaping).

Gotchas worth knowing

Partial matches. Searching for cat changes category too. This is the single most common find-and-replace accident. Use the whole-word toggle, and glance at the preview highlights before copying.

Rule order matters. Rules run sequentially, so rule 2 operates on the output of rule 1. Replace cat with dog and then dog with ferret, and your cats become ferrets. Chains like this are handy when intentional and baffling when not, which is exactly why each rule shows its own match count.

Case sensitivity is off by default. Searching red also matches Red unless you turn on the Aa toggle. For prose edits the default is usually what you want; for code and IDs, turn it on.

Greedy quantifiers eat too much. In regex mode, ".*" across "a" and "b" matches the whole span from the first quote to the last. Use the lazy form ".*?" to match each quoted section separately.

Zero-match rules are usually typos. Invisible characters cause most "why won't it match" moments: a non-breaking space instead of a normal one, a curly quote instead of straight. The straighten-quotes recipes above fix the usual suspects. For deeper cleanup, run the text through the text cleaner first.

Troubleshooting

"Invalid pattern" on a rule? The exact error from the regex engine shows under the rule, and that rule is skipped while the rest keep running. The usual causes: an unclosed parenthesis or bracket, or a stray \ at the end. If you didn't mean to write regex at all, switch the rule back to literal mode.

Replacement produced fewer changes than the match count suggested? Check whether an earlier rule already rewrote some of that text. Counts are per rule, in order.

Need to replace across line breaks? . doesn't cross newlines. Use [\s\S] in place of . when the match should span lines, or remove the line breaks first with the line break remover.

Pasted from Word or Google Docs and matches are weird? Office apps insert smart quotes and non-breaking spaces that look identical to their plain cousins. Straighten quotes with the recipes above or convert everything with the plain text converter.

Related tools

Privacy and security

All matching and replacing happens locally in your browser using the JavaScript regex engine. Your text never leaves your device, and the tool keeps working offline once loaded.

Frequently Asked Questions
Literal mode searches for the exact characters you typed, so searching for 3.14 matches only 3.14. Regex mode treats the Find field as a regular expression pattern, where \d+ matches any run of digits and [a-z]+ matches lowercase words. If you just want to swap one string for another, stay in literal mode; it can never surprise you with special-character behavior.
Yes, and this is the main reason to use this tool over a basic single-field replacer. Add as many rules as you need and they run top to bottom in one pass. Filling a template with three placeholders, or normalizing both kinds of curly quotes, takes one click instead of three round trips through the tool.
Yes. Rules apply sequentially, so a later rule sees the output of the earlier ones. If rule 1 replaces 'cat' with 'dog' and rule 2 replaces 'dog' with 'ferret', every original 'cat' ends up as 'ferret'. This is occasionally surprising but also useful: you can chain a cleanup rule after a substitution rule on purpose.
Yes. Wrap parts of the pattern in parentheses and reference them in the replacement with $1, $2, and so on. For example, find (\d{2})/(\d{2})/(\d{4}) and replace with $3-$2-$1 to turn 04/07/2026 into 2026-07-04. $& inserts the whole match, and $$ produces a literal dollar sign.
Plain text search matches anywhere inside words. Turn on whole-word mode (the |w| toggle) and the match must stand alone, so 'cat' matches 'the cat sat' but leaves 'category' and 'concatenate' untouched. It works in both literal and regex mode.
Leave the Replace field empty. Every match is removed. Combined with regex mode this is a quick way to strip URLs (https?:\/\/\S+), trailing spaces ( +$), or any repeating junk from pasted text.
Each line. This tool always applies the multiline flag because nearly every practical recipe (removing trailing whitespace, prefixing lines, deleting empty lines) expects per-line anchors. There is no separate flag to remember.
In literal mode, nothing special: the tool escapes it for you, so replacing 'price' with '$5' inserts exactly $5. Many online replacers get this wrong and silently eat the dollar sign. In regex mode, $ is meaningful ($1 is a group reference), so write $$ when you want a literal dollar sign.
The rule shows an inline error with the exact message from the regex engine, and that rule is skipped while the others keep working. Your text is never half-processed by a broken pattern.
No. Matching and replacing run entirely in your browser with JavaScript's own regex engine. Nothing you paste is sent to a server, which also means the tool works offline once the page has loaded.