Skip to content
ToolBoxGeniehome

Find and Replace

Text Tools · Added

Paste the text, say what to look for and what to put in its place. Plain-text mode takes every character literally, so brackets and dots search for themselves. Regular expression mode hands the pattern to your browser own engine, with capture groups available in the replacement. Either way the original stays on screen beside the result, so you can adjust the pattern and try again.

Everything happens in your browser. Nothing you paste is uploaded.

Match

Matched exactly as typed — brackets and dots are not special.

Inserted literally. Leave empty to delete every match.

How to use the find and replace

  1. 1Paste or type the text you want to change into the first box.
  2. 2Choose Plain text for a literal search, or Regular expression for a pattern.
  3. 3Fill in what to find and what to replace it with. Leave the replacement empty to delete every match.
  4. 4Set the options: match case, whole words only, first match or all of them.
  5. 5Read the match count and the preview list, then copy or download the updated text.

Examples

A literal replacement

Input
Find: Acme Pvt Ltd — Replace: Acme Private Limited
Result
Every occurrence changed, with a count of how many

In plain-text mode nothing in the search box is treated as a pattern, so a company name containing a full stop or brackets works as typed.

Reordering with capture groups

Input
Regex: (\\w+), (\\w+) — Replace: $2 $1
Result
Sharma, Ravi becomes Ravi Sharma

$1 and $2 insert what the brackets captured, which is how a list of surname-first names is flipped in one pass.

Deleting a pattern

Input
Regex: \\s{2,} — Replace: (empty)
Result
Every run of two or more spaces removed

An empty replacement deletes rather than replaces. Add a single space instead to collapse runs down to one.

About the find and replace

The two modes, and why both exist

Literal search is what people want most of the time and what most tools make hardest. You know the exact string, you want it gone, and you do not want to think about which of its characters are special. Escaping the pattern before it reaches the engine costs nothing and removes an entire category of confusion, which is why plain text is the default here.

Regular expressions earn their complexity when the thing you are matching has a shape rather than a value. Every date in a file, every trailing space, every phone number with an inconsistent separator, every occurrence of a word that is not part of a longer word. None of those can be expressed as a literal string, and all of them are a few characters of pattern.

The capture group is the feature that turns find-and-replace from deletion into restructuring. Bracketing part of a pattern remembers what it matched, and referring to it in the replacement as a numbered slot lets you reorder, reformat or wrap it. Flipping a comma-separated name, turning a date from one order into another, wrapping a bare URL in a link — all the same one-line move.

Habits that stop a replacement going wrong

Look at the match count before you look at the output. It is the fastest check there is: if you expected a dozen and it says four hundred, the pattern is matching more than you meant, and the preview list underneath will usually show why in the first line. Finding that out before the replacement is applied costs nothing.

Use whole words when replacing a short one. Replacing cat with dog across a document also turns catalogue into dogalogue and duplicate into dupligate, which is the classic demonstration of why the option exists. The boundaries are added around the whole pattern rather than around each alternative, so an expression like cat or car is bounded as a unit.

For anything irreversible, work in stages. Replace once, read the result, then paste the result back in and replace again for the next transformation, rather than trying to express three changes in one clever pattern. Each step is easy to verify and easy to abandon. The original stays untouched in the box above throughout, which is what makes that loop cheap here.

Frequently asked questions

When should I use plain text rather than a regular expression?
Whenever what you are looking for contains characters a regex treats as syntax — full stops, brackets, question marks, plus signs, dollar signs. Searching for the literal string price (INR) as a pattern either fails to compile or silently matches something else, because the brackets become a capture group. Plain-text mode escapes all of it for you, which makes it the right default and the mode to fall back on when a pattern is behaving strangely.
How do I insert a line break in the replacement?
Tick the escapes option, then type a backslash followed by n where you want the break. Without it, a backslash and an n are inserted as those two characters, which is deliberate — plenty of replacements legitimately contain backslashes, and silently interpreting them would corrupt file paths and code. The same option handles a tab as backslash-t and a literal backslash as two of them.
Why does a dollar sign in my replacement disappear?
It should not, in plain-text mode — that mode escapes dollar signs so they come through as typed. In regular expression mode a dollar sign followed by a digit is a back-reference to a captured group, and one followed by an ampersand inserts the whole match, so both are consumed rather than printed. To get a literal dollar sign in regex mode, write two of them.
Is my text uploaded anywhere?
No. The matching and replacing happen in JavaScript in this tab, using the regular expression engine your browser already ships. Nothing is transmitted, nothing is written to storage, and closing the tab is enough to be rid of it. That is the reason this is usable on a contract, an export or anything else you would not paste into a web service that keeps what it receives.