Find and Replace
Swap one piece of text for another across the whole input. Match a literal string, a whole word only, or a full regular expression with custom flags and $1 backreferences in the replacement.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
Three ways to match
Plain text finds the literal characters and replaces every occurrence. Whole word matches a word on its own with word boundaries, so "cat" in "category" is left alone while "cat" in "a cat" is replaced. Regular expression treats the Find field as a pattern and lets you build complex matches, with the flags field controlling behaviour — g for all matches, i to ignore case, m for multi-line. The stats line reports how many replacements were actually made.
Backreferences in the replacement
In regex mode the replacement string is passed through untouched, so $1, $<name> and $& all work: capture groups with parentheses and reference them in the output, for example swapping first and last name with (\w+) (\w+) replaced by $2, $1. In plain and whole-word mode a literal $ is preserved as-is rather than interpreted, because there are no capture groups to expand.
A realistic workflow
Renaming a variable across a file, normalising spacing, or de-duplicating a label by rewriting a pattern are all one paste away. For a copy you want to keep, toggle Case insensitive so that Title, title and TITLE are all caught in a single pass, or fold it off when case carries meaning and only exact matches should change.
Errors and privacy
An invalid regular expression or an unknown flag raises a clear error instead of silently doing nothing, so a broken pattern is caught immediately. The replace runs in the page with no request and no upload, so a confidential document stays on your device and the whole operation works offline.
Questions
Are $1 backreferences supported?
In regex mode, yes — the replacement string is passed through untouched, so $1, $<name> and $& all work. In plain and whole-word mode a literal $ is kept as-is.
What happens with an invalid pattern?
An invalid regular expression or an unknown flag raises a friendly error instead of a silent no-op.
Does it replace every match?
Plain and whole-word mode always replace all matches. Regex mode replaces all only when the flags include "g".
Related tools
See categoryRemove Empty Lines
Strip blank and whitespace-only lines, collapse blank runs to one, or trim trailing blanks.
Add Line Numbers
Prefix every line with a running number, with configurable start, separator, zero-padding.
Case Converter
Convert between UPPER, lower, Title, Sentence, camelCase, snake_case, kebab-case and more.
Slugify
Turn a title into a clean URL slug — lowercase, hyphenated, accent-folded.