Skip to content
TypeParser
All tools

Find & Replace

Bulk find and replace with regex.

beats textmechanic.com edge: Regex + capture groups + preview
input
find
replace
Guide

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

GoalFindReplace
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?
Toggle. Plain treats the find string literally. Regex treats it as a JavaScript regex (PCRE-like with some differences).
How do capture groups work?
In regex mode, (\w+) (\w+) captures two words. Replace with $2 $1 swaps them. Test patterns in the Regex Tester first.
Will it preview before applying?
Yes — the preview pane shows highlighted matches and the proposed replacement. Apply once you are confident.
Whole-word matching?
Toggle to wrap the find string in \b...\b automatically — ensures cat matches the word "cat" but not "category".
How big a document?
Up to a few MB cleanly. Above that, use a real editor or command-line sed / perl.
Multiple finds at once?
Toggle Multi-replace. Add as many find/replace pairs as you need; they apply in order.

Related tools

Last updated: 2025-01-15