Find and Replace Text Online — Regex, Multiple Rules, Live Preview
Replace every occurrence at once: plain text, whole words or regular expressions, several rules in a row, with matches highlighted as you type.
🔒 Runs in your browser — files never uploaded ⚡ No signup 💯 Free
Paste your text, type what to find and what to put in its place, and watch the result update as you type, with every match highlighted in your text first. Add as many find → replace rules as you need and they run in order, so a whole clean-up job is one paste.
Plain mode matches exactly what you type; tick whole words so "cat" leaves "category" alone, and keep capitalisation so Cat becomes Dog and CAT becomes DOG. Switch on regular expressions for patterns, with $1 capture groups, \n line breaks and \U/\L case changes in the replacement, and a table showing what every group captured.
How to use Find & Replace
- Paste your text into the top box.
- Type what to find and the replacement. Leave the replacement empty to delete matches. The match count and highlights update as you type.
- Add more rules with "+ Add another rule"; they run top to bottom, each on the output of the previous one.
- Pick options: match case, whole words, keep capitalisation, or regular expression. In regex mode, the chips insert common patterns.
- Copy or download the result, or click "Use result as input" to keep working on it.
Regex find and replace, step by step
Tick "Regular expression" and the Find box takes a JavaScript pattern. Parentheses capture parts of each match, and the replacement refers to them as $1, $2 and so on; $& is the whole match and $<name> a named group. Some everyday jobs:
- Swap "Last, First" to "First Last": find
(\w+), (\w+), replace$2 $1. - Change an email domain: find
(\w+)@old\.com, replace$1@new.com. The dot is escaped because a bare.matches any character. - Reformat dates: find
(\d{4})-(\d\d)-(\d\d), replace$3/$2/$1. - Strip trailing spaces: find
\s+$, replace with nothing. Delete blank lines: find^\s*\n. - Capitalise each word: find
\b(\w), replace\u$1.
The groups table under the highlighted text shows what each match captured, which is the fastest way to debug a pattern. By default ^ and $ match at the start and end of every line, as in code editors; untick that option to match only the start and end of the whole text, and tick ". matches line breaks" to let .* span lines.
Replacement syntax
$1…$99,$&,$<name>: captured text.$$: a literal dollar sign.\n,\t: a line break or a tab, so you can split or join lines.\U…\Euppercase and\L…\Elowercase everything in between;\uand\lchange just the next character. This is the syntax of VS Code, Sublime Text and Perl, which JavaScript itself does not support.
In plain mode everything is literal: searching for 3.50 finds exactly that, and a replacement of $100 inserts "$100". To replace line breaks without regex, tick "Use \n for line break" and type \n in either box.
Several replacements at once
Each rule runs on the output of the one above it, so order matters: replacing red with green and then green with blue turns everything blue. Every rule shows its own match count, and a rule with an invalid pattern is skipped with an explanation instead of breaking the rest. A pattern that could match empty text (such as a*) is refused, because it would insert the replacement between every character.
Whole words and capitalisation
Replacing cat with dog also turns category into dogegory, the classic find-and-replace accident. "Whole words only" restricts matches to standalone words, including words with accented letters. Matching ignores case by default; "Keep capitalisation" then copies the shape of each match onto the replacement, so a sentence-initial "Cat" becomes "Dog" rather than "dog". Turn on "Match case" when the distinction matters, such as renaming userName in code without touching username.
Private by design
Your text never leaves the browser: matching and replacing run locally, so it is safe for logs, code and documents with personal data. To compare two versions instead of changing one, use the diff checker; to change letter case across a whole text, the case converter is quicker.
Frequently asked questions
How do I use regex in find and replace?
Tick "Regular expression", type a pattern in Find, and use $1, $2 in the replacement for the parts captured by parentheses. The highlighted preview and the groups table show what matched before you copy the result.
Can I do several find and replace operations at once?
Yes. Click "+ Add another rule" for each extra pair. The rules run from top to bottom, each on the result of the previous one, and each shows its own match count.
How do I replace line breaks or tabs?
In regex mode, use \n and \t in Find or Replace. In plain mode, tick "Use \n for line break, \t for tab" first. For example, find \n and replace with , to join lines into a comma-separated list.
How do I delete text instead of replacing it?
Leave the replacement box empty. Every match is removed.
What does "whole words only" do?
It matches the search term only where it stands as a word on its own, so "cat" matches in "the cat sat" but not in "category" or "concatenate". It works with accented letters too.
Can the replacement change letter case?
Yes, in two ways. "Keep capitalisation" copies each match's shape (cat→dog, Cat→Dog, CAT→DOG). In regex mode, \U…\E uppercases and \L…\E lowercases part of the replacement, and \u capitalises the next character.
What regex flavour is supported, and why is my pattern refused?
JavaScript regular expressions, including lookbehind and named groups. A pattern is refused if it is invalid (the message says why) or if it can match empty text, which would insert the replacement between every character.
Is my text sent to a server?
No. All matching and replacing happens in your browser, and nothing is stored. You can disconnect from the internet after the page loads and it keeps working.