Find and replace is the quickest way to apply the same edit to a long text: rename a product, fix a recurring typo, reformat dates, strip stray characters. Our Find and Replace Tool does this in the browser, with three options (case sensitive, whole word, regular expressions) and a live match count. This guide covers each option, a set of tested regex recipes, and the behaviours that catch people out, including a few where the tool differs from what you may expect from a code editor.
Every input and result in this guide was produced by running the page, and the results are quoted exactly. In the examples, \n in a quoted string means a line break in the text.
How to use it
- Paste your text into Your text.
- Type what to look for in Find. A line under the options shows N match(es) found and updates a moment after each change.
- Type the replacement in Replace with. Leave it empty to delete the matches.
- Choose options: Case sensitive, Whole word only, Use Regex.
- Click Replace All. Every match is replaced at once.
- Copy Result or Download .txt (the file is named
result.txt).


Two things to know before you start. First, Replace All changes the text box itself. There is no separate output and no undo button; pressing Ctrl+Z after a replacement did not bring the old text back in our test. Keep a copy of the original until you have checked the result. Second, the match count is the quickest safety check: if you expected 12 changes and it says 112, stop and look at your pattern.
Plain text mode and special characters
With Use Regex off, whatever you type in Find is treated as ordinary text, so characters that have a meaning in regular expressions are safe. These all worked as literal text:
find $5.00 in "Price: $5.00 (approx.) [a] a.b a+b *x*" -> 1 match
find a.b in "a.b axb a.b" -> 2 matches (axb is not matched)
find (x) in "f(x) + g(x)" -> 2 matches
find \ in "C:\Users\me" replace / -> C:/Users/me
find C++ in "I like C++ and C#" replace Rust -> I like Rust and C#
By default matching is not case sensitive: cat matches Cat and CAT. Tick Case sensitive to match exact capitalisation. On the sample The cat sat. The Cat ran. category cat., replacing cat with dog gave:
default: The dog sat. The dog ran. dogegory dog. (4 matches)
Case sensitive: The dog sat. The Cat ran. dogegory dog. (3 matches)
Whole word only: The dog sat. The dog ran. category dog. (3 matches)
Both: The dog sat. The Cat ran. category dog. (2 matches)
The first row shows why the next option exists: category became dogegory.
Whole word only: where it works and where it does not
The option wraps your search in a word-boundary check, so cat no longer matches inside category. It is based on plain English letters, digits and underscores, which gives three kinds of surprise:
- Terms that start or end with a symbol never match.
C++and@bobeach gave 0 matches with Whole word only ticked, although they matched with it off. Leave the option off for such terms. - Accented letters count as breaks.
cafégave 0 matches incafé cafe naïve, and searchingnainnaïve nareplaced the start ofnaïveas well as the real word, givingXïve X. - With regex on, alternation needs brackets. The tool puts the boundary check around your whole pattern, so
cat|dogis read as "cat at the start of a word, or dog at the end of a word". Oncat dog category dogmait gavePET PET PETegory dogma. Writing(cat|dog)fixed it:PET PET category dogma.
Regular expressions
Tick Use Regex and the Find field is read as a JavaScript regular expression, matched across the whole text with the global flag (all matches) and, unless Case sensitive is ticked, the case-insensitive flag. Common building blocks work as you would expect: \d, \w, \s, character classes, ?, +, *, {n,m}, groups, lookahead such as foo(?=\d) and lookbehind such as (?<=price )\d.
If the pattern is not valid, a red message appears and nothing is replaced. The messages come from the browser, and the tool adds its own prefix, so the wording is repeated:
(abc -> Invalid regular expression: Invalid regular expression: /(abc/gi: Unterminated group
*abc -> Invalid regular expression: Invalid regular expression: /*abc/gi: Nothing to repeat
[a- -> Invalid regular expression: Invalid regular expression: /[a-/gi: Unterminated character class
The message shows the pattern with its flags (gi), which is a quick way to confirm which flags are active. An empty Find field gives Please enter something in the "Find" field. when you click Replace All.
Capture groups and $ references
Wrap part of the pattern in brackets to capture it, then reuse it in Replace with as $1, $2, and so on. The screenshots above use this to turn year-month-day dates into day/month/year:
Find: (\d{4})-(\d{2})-(\d{2})
Replace: $3/$2/$1
Text: Date: 2024-03-15 and 2025-12-01
Result: Date: 15/03/2024 and 01/12/2025
More tested recipes (all with Use Regex ticked):
Swap "Last, First": (\w+), (\w+) -> $2 $1 Smith, John => John Smith
Named groups: (?<first>\w+) (?<last>\w+) -> $<last>, $<first> John Smith => Smith, John
Mask an email name: (\w+)@([\w.]+) -> ***@$2 bob@example.com => ***@example.com
Collapse spaces: \s{2,} -> (one space) a b c => a b c
Remove digits: \d+ -> (empty) a1b22c333 => abc
Optional letter: colou?r -> hue color colour => hue hue
Add a dollar sign: (\d+) -> $$$1 cost 5 and 10 => cost $5 and $10
The dollar sign in the replacement, even with regex off
The replacement text is interpreted by JavaScript's replace rules even when Use Regex is off. Some $ combinations therefore do not come out literally:
$$becomes one$. Replacing5with$$5incost 5gavecost $5, and$$$$gavecost $$.$&inserts the matched text. Replacing10with$&$&turnedcost 10intocost 1010.$`and$'insert the text before and after the match. Replacingbinabcwith[$`|$']gavea[a|c]c.$1with no matching group stays as typed (cost $1), and so does$0. A plain$5is therefore safe unless your pattern has five groups.
To write a literal dollar sign immediately before a digit or & in the replacement, double it: $$.
Mistakes and limits that cost time
Greedy matching takes too much
.* matches as much as it can. On <b>one</b> and <b>two</b>, the pattern <b>.*</b> replaced the whole line with a single X. Adding a question mark makes it lazy: <b>.*?</b> gave X and X.
^ and $ match the start and end of the whole text, not each line
The tool's Regex Quick Reference describes them as the start and end of a line, but in our tests they did not behave that way. On - one\n- two\n- three, ^- found 1 match and changed only the first line, and [ \t]+$ found 0 matches in a \nb \nc. Work around it by naming the line break:
Line starts: (^|\n)- (note the final space) replace $1* (final space too) => * one / * two / * three (3 matches)
Trailing space: [ \t]+(?=\n|$), replace empty => a / b / c (2 matches)
The dot does not match a line break
a.b found nothing in a\nb. Use [\s\S] for "any character including a line break": a[\s\S]b matched.
You cannot type a line break in Replace with
Both boxes are single-line fields. A two-line string put into Replace with came back as x y in our test, and typing \n in the replacement inserts a backslash and the letter n, not a line break (a,b,c became a\nb\nc). In Find with regex on, \n and \t do match line breaks and tabs, so you can remove or re-use them. For example, (\n)\s*\n+ replaced with $1 turned a\n\n\n\nb\n\nc into a\nb\nc (all blank lines removed), and (\n\n)\n+ replaced with $1 kept one blank line between paragraphs. If you need to insert new line breaks, use a text editor.
Unicode
The search runs without the Unicode flag. \p{L}+ matched nothing in héllo wörld, and ^.$ did not match a single emoji because an emoji is stored as two units. Case-insensitive search does match ÉCOLE with école, but straße and STRASSE are different words to it.
Empty matches
A pattern that can match nothing, such as x*, matches at every position. On abc it showed 4 matches and the replacement - produced -a-b-c-.
A pattern can freeze the tab
Patterns with a repeated group inside a repeat, like (a+)+$, can take exponentially longer as the text grows. On a string of a characters followed by b, the page took about 0.2 seconds at 20 characters, 1.7 seconds at 24, 3.4 seconds at 26 and 13 seconds at 28 before responding. Because the match count re-runs your pattern as you type, such a pattern can lock the tab before you press anything. Avoid nested repeats, try new patterns on a short sample first, and close the tab if it stops responding.
Speed on ordinary text
For normal patterns it is fast: replacing ipsum with IPSUM in a 1,080,000-character text made 40,000 replacements in about a third of a second on our test machine.
Everyday uses
- Rename a term everywhere with Whole word only on, so
dogchanges anddogsanddogmado not (cat dogs cat.fromdog dogs dog.). - Straighten quotes or swap characters such as
"to', or•to-(with regex off). - Clean exported data by deleting runs of digits, collapsing spaces or removing blank lines with the recipes above.
- Reformat structured text such as dates and names with capture groups.
- Check a change. Paste the original and the result into Text Compare to see exactly what moved, and use the Regex Tester if you want to develop a pattern with more feedback before using it here.
Privacy
The matching and replacing is done by JavaScript in your browser. We watched the network traffic while pasting text and clicking Replace All: after the page had loaded, no requests were made. The page loads Bootstrap and an icon font from a public CDN when it opens, and the site may show ads from third-party networks that are separate from the tool, so do not paste passwords or other secrets.
Quick answers
Does it replace only the first match? No, it replaces every match.
Is it case sensitive by default? No. Tick Case sensitive to make it so.
Can I undo? Not in the tool. Keep a copy of the original before replacing.
Why did my replacement show $1 literally? That happens when the pattern has no first group, or when Use Regex is off and there are no groups at all.
Which regex flavour is it? The one built into your browser (JavaScript), so look up JavaScript syntax rather than PCRE or Python when you search for help. Lookbehind and named groups worked in our Chromium tests; other browsers may differ for newer features.
Have a repeated edit to make?
Open the Find and Replace Tool