Find and Replace
Search and replace across any block of text, with literal or regular expression matching. Every match is highlighted live, you can step through them one at a time, and capture groups like $1 work in the replacement. Case-sensitive and whole-word options included, plus a 10-step undo. Everything runs in your browser. Free, no signup.
How to Use This Tool
- Paste your text — drop the content into the text box, or press Sample to load a worked example.
- Enter what to find and what to replace it with — type a plain phrase, or tick Regular expression to use a pattern with capture groups.
- Tune the match — toggle case sensitivity and whole-word matching. The match count and highlights update as you type.
- Replace, then copy — use Replace all, or step through with Next and Previous and replace one at a time. Undo reverses the last ten changes.
About Find and Replace & Regular Expressions
Find and replace is the most underrated productivity tool in any editor, and its value scales with the size of the job. Renaming a product across a 5,000-word document, updating a domain in a hundred links, swapping a price throughout a proposal, or normalising inconsistent spellings before publication are all tasks that take an hour by hand and seconds mechanically. The mechanical version is also more reliable, because a human scanning for the fortieth occurrence of a word will eventually miss one. The live match count here exists precisely so you know how many changes you are about to make before you commit to them.
The two options that matter most are also the ones people skip. Case sensitivity is off by default, which means searching for "apple" also finds "Apple" and "APPLE". That is usually what you want when cleaning up inconsistent copy, but it is dangerous when case carries meaning, as it does in code, where a variable and a class can differ only by their first letter. Whole-word matching is the other guard rail: without it, searching for "cat" also rewrites "category", "concatenate" and "location". Turning it on wraps your search in word boundaries so only standalone occurrences match. Between them, these two toggles prevent most find-and-replace accidents.
Regular expressions turn a literal search into a pattern search, and that is where the real power sits. Instead of finding one exact string, you describe a shape: any sequence of digits, any email address, any line that starts with a hyphen, any word repeated twice. A pattern like \d{4} matches any four-digit number, so you can find every year in a document without listing them. Capture groups extend this to rearranging text rather than just replacing it. Wrapping part of a pattern in parentheses stores what it matched, and referring to it as $1 in the replacement drops it back in — which is how you convert dates from one format to another, or flip "Surname, Firstname" into "Firstname Surname", in a single pass.
Regex earns its reputation for being difficult mainly because of escaping. Characters like a dot, question mark, plus sign, asterisk, parenthesis and square bracket all have special meanings, so searching for a literal dot with the pattern . matches every character instead. The fix is a preceding backslash, making it \.. This is the single most common source of surprising results, and it is why this tool escapes your input automatically unless you explicitly tick Regular expression. When a pattern will not compile at all, the field turns red and shows the error rather than silently matching nothing.
A word of caution that applies to every replace-all button ever built: the operation is exhaustive and indifferent. It will happily rewrite text inside URLs, code snippets, email addresses, quoted material and anywhere else the pattern happens to appear. The safe workflow is to check the match count first, glance at the highlighted preview, and use whole-word matching whenever your search term could appear inside a longer word. For genuinely risky changes, step through with Next and replace one at a time. And if you find yourself doing this across dozens of published pages every month, the underlying problem is a content operations one rather than a tooling one.
Pair this with our Text Diff Tool to verify exactly what a replacement changed, the Case Converter for consistent casing, and the Word Counter to check length after a bulk edit.
Frequently Asked Questions
What is a regular expression and when should I use one?
A regular expression is a pattern that describes a shape of text rather than one exact string. Instead of searching for a specific phone number, you can search for any sequence of three digits, a hyphen and four more digits. Use a literal search when you know the precise text you want, which covers most everyday edits. Reach for regex when the thing you are looking for varies: dates in mixed formats, numbers of unknown length, every URL on a page, lines starting with a particular character, or repeated whitespace. The trade-off is that regex is easy to get subtly wrong, so always check the match count and the highlighted preview before replacing.
How do capture groups and $1 work in the replacement?
Wrapping part of your pattern in parentheses creates a capture group, which remembers whatever that part matched. You can then insert it into the replacement using a dollar sign and its number, counting groups from left to right. For example, searching for (\w+), (\w+) and replacing with $2 $1 flips "Surname, Firstname" into "Firstname Surname" everywhere in one pass. You can use $1 through $9, $& to insert the whole match, and $$ for a literal dollar sign. Capture groups are what turn find-and-replace from a substitution tool into a genuine reformatting tool.
What does the whole word option actually do?
It wraps your search term in word boundaries, so it only matches when the term stands alone rather than sitting inside a longer word. Without it, searching for "cat" also matches "category", "concatenate" and "location", which is one of the most common ways a replace-all goes wrong. With it on, only the standalone word "cat" matches. A word boundary is the position between a word character and a non-word character, so hyphens, spaces and punctuation all count as boundaries. Turn it on whenever your search term could plausibly appear as a fragment of something longer.
Why is my search finding more or fewer matches than I expect?
There are three usual causes. Case sensitivity is off by default, so "apple" also matches "Apple" and "APPLE" — tick Case sensitive if that matters. Whole-word matching is also off by default, so short search terms match inside longer words. And if you have ticked Regular expression, special characters in your search are being interpreted as pattern syntax rather than literal text, so a dot matches any character and a question mark makes the preceding character optional. Untick Regular expression for a plain literal search, or escape the special characters with a backslash.
How do I search for a literal dot, dollar sign or bracket?
If Regular expression is switched off, you do not need to do anything — the tool escapes your input automatically, so every character is treated literally. If regex is on, put a backslash in front of the character to strip its special meaning. So \. matches a literal dot, \$ a literal dollar sign, \( a literal opening parenthesis, and \\ a literal backslash. The characters that need escaping are . * + ? ^ $ { } ( ) | [ ] and the backslash itself. Forgetting to escape a dot is the single most common regex mistake, because an unescaped dot silently matches everything.
Can I match across multiple lines?
Yes, with a caveat about the dot. The search runs over the whole text including its line breaks, so a pattern such as end\nstart will match across a line boundary, and \s matches newlines as well as spaces and tabs. The exception is the dot, which in JavaScript regular expressions matches any character except a line break. To match any character including newlines, use a character class like [\s\S] instead of a dot. Similarly, ^ and $ anchor to the start and end of the entire text here rather than to each individual line.
Is it safe to click Replace all?
It is safe in the sense that nothing is permanent — the last ten changes are held on an undo stack, so you can step back. But the operation itself is exhaustive and indifferent: it rewrites every match, including ones inside URLs, code, email addresses and quoted text. The habit worth building is to look at the match count and the highlighted preview before committing, and to turn on whole-word matching whenever your term could appear inside a longer word. For changes where a mistake would be expensive, use Next and Replace current to step through them one at a time.
Is my text sent to a server?
No. All searching and replacing happens in your browser using client-side JavaScript. Your text is never uploaded, never logged, and never stored anywhere except optionally in your own browser localStorage, which keeps your last input so a page reload does not lose your work. Pressing Clear removes that saved copy. Because nothing leaves your machine, the tool is safe for contracts, internal documents, customer data, configuration files and anything else you would not want passing through someone else server.