RunLocalTools

Find and Replace Text Online — Regex, Case-Preserving, Batch Rules (Free)

Find and replace text with regex support, whole-word matching, capture groups, and case-preserving replacement. Stack multiple rules in one pass. Runs in your browser — free, no limits.

What it does

Paste text, type what to find and what to replace it with, and get the result instantly — with plain-text or regex matching, whole-word and case-sensitivity toggles, and a live diff so you can see exactly what changed before you commit to it. Stack several find-and-replace rules together and run them in a single pass, each with its own settings.

How it works

In plain-text mode, your search term is escaped and matched literally — a period matches a period, not “any character.” Flip on regex mode and the same field becomes a real JavaScript-flavored regular expression, with capture-group substitution in the replacement ($1, $2, $& for the whole match, $$ for a literal dollar sign). The preserve case option looks at how the matched text was capitalized — all-caps, Title Case, or lowercase — and applies the same casing pattern to your replacement automatically, so replacing “hello” with “globe” inside “HELLO WORLD” gives you “GLOBE WORLD,” not a jarring case mismatch. Every rule runs through a shared regex engine with a hard iteration cap, so even a pathological pattern can’t freeze the tab.

How to use it

  1. Paste or type your source text, or drop in a .txt/.csv/.md file.
  2. Fill in the Find and Replace fields for your first rule, and toggle regex, case-sensitivity, whole-word, or preserve-case as needed.
  3. Watch the live diff update as you type — additions and removals are highlighted inline.
  4. Need more than one substitution? Click + Add rule to stack another find-and-replace pair; rules run in order, each against the previous rule’s output.
  5. Click Apply to source to fold the result back into the editable source text (handy for a multi-step cleanup), or just copy/download the result directly. Undo to original always gets you back to what you started with.

FAQ

Does “whole word” work with punctuation-only search terms?

Whole-word matching uses a regex word boundary (\b), which is defined around letters, digits, and underscores — it works reliably for things like cat vs. category, but can behave unpredictably around search terms that are pure punctuation (like C++), since there’s no clean “word edge” next to symbols. This is a known regex limitation, not a bug specific to this tool.

Can I use capture groups to reorder or reformat matched text?

Yes — in regex mode, wrap the parts you want to keep in parentheses and reference them in the replacement with $1, $2, and so on. For example, finding (\d{4})-(\d{2})-(\d{2}) and replacing with $2/$3/$1 converts 2026-09-20 into 09/20/2026.

What does “preserve case” actually do?

It detects whether the matched text was all uppercase, all lowercase, or capitalized like a title/name, and reshapes your replacement to match that same pattern — so one rule works correctly whether the target word appears as “Email”, “EMAIL”, or “email” in your text.

Will a bad regex freeze the page?

No — every match runs through a shared, capped engine, and an invalid or catastrophically slow pattern shows a clear error instead of hanging the tab.

Does this handle really large documents?

Yes, replacement is done in a single linear pass regardless of how many matches there are — tens of thousands of matches process in well under a second.

For an explanation of what a specific regex pattern actually does before you commit to using it here, try Regex Explain. If you’d rather test a pattern interactively against sample text first, the Regex tester is built for that. And once you’ve made your edits, a straightforward before/after comparison is available with Diff.