About Find & Replace
Find and replace text with optional regex, case-insensitive, whole-word, and capture-group support (<code>$1</code>, <code>$2</code>). Preview replacements before applying so a bad pattern does not destroy the source. Useful for batch refactors, log cleanup, and text reformatting at scale.
When you need a tool, not your editor
Editors handle find-and-replace fine for code. The tool here shines when you have:
- Pasted-in text that does not deserve a file
- Multi-line regex with backreferences
- Multi-replace (apply 5 patterns in sequence) — most editors do this awkwardly
- Privacy concerns — text you would not want to save to disk
Pattern recipes
| Goal | Find | Replace |
|---|---|---|
| Wrap each line in quotes | ^(.+)$ | "$1" |
| Strip trailing whitespace | \s+$ | (empty) |
| Convert spaces to tabs | | \t |
| Add comma at end of every line | $ | , |
| Mask emails (keep domain) | \S+@(\S+) | ***@$1 |
| Convert markdown link to bare URL | \[([^\]]+)\]\(([^)]+)\) | $2 |
Common workflows
Mask sensitive data before sharing. Replace credit-card-like patterns, emails, IP addresses with placeholders.
Reformat a list. Paste a CSV, regex-replace , with \n to get a vertical list.
Bulk-rename in a config. Paste the YAML, find old environment name, replace with new — apply to every occurrence at once.
Strip ANSI color codes from a paste. Find \x1b\[[0-9;]*m, replace with empty.
Clean a copy-pasted list. Multi-replace: trim whitespace, drop blank lines, lowercase, dedup.
Frequently asked questions
Plain or regex?
How do capture groups work?
(\w+) (\w+) captures two words. Replace with $2 $1 swaps them. Test patterns in the Regex Tester first.Will it preview before applying?
Whole-word matching?
\b...\b automatically — ensures cat matches the word "cat" but not "category".How big a document?
sed / perl.Multiple finds at once?
Related tools
Last updated: 2025-01-15