Skip to content
cliplimeClipLime

Find and replace in your text

Change text with plain or regex rules, see the result as you type, and review each match if you want to.

Your text

0 characters, 0 lines

Rules

Rules run from the top, each one on the result of the one above. The result updates as you type.

In regex mode, use $1 or $<name> for groups, $& for the whole match and \n or \t for a line break or tab. In plain mode, the replacement is used exactly as typed.

Result

Your text is searched and replaced in this tab, in a worker on your device. Nothing is uploaded.

At a glance

What it does
Finds text and replaces it, in plain text or with regular expressions, and shows the result as you type.
Several rules
Add as many rules as you need. They run from the top down, each one on the result of the one above.
Options per rule
Regex, Match case and Whole word. Whole word counts letters, accents, digits and underscores in any language, so café is one word, even when the accent is a separate character.
Step through
Go through the matches one at a time and choose Replace or Skip, with Undo and Replace all remaining.
Safe patterns
Everything runs in a separate worker that is stopped after 3 seconds, so a runaway regex cannot freeze the page.
Limits
Up to 250,000 matches per rule in one run. The text itself is limited only by your browser's memory.
Privacy
Your text never leaves the browser. Nothing is uploaded or stored.

How to do it

  1. 1

    Paste or load your text

    Type or paste into the text box, or use Load a file to read a plain text file. The file is read on your device.

  2. 2

    Write a rule

    Type what to find and what to replace it with. Leave the replacement empty to delete every match.

  3. 3

    Pick the options

    Switch on Regex for patterns, Match case to respect capital letters, and Whole word to skip matches inside longer words.

  4. 4

    Copy the result

    The text after replacing is on the right. Copy it or download it as a text file. Add more rules, or switch to Step through to review each match.

Plain text or regular expression

In plain mode the tool looks for exactly what you type. A dot is just a dot and an asterisk is just an asterisk, so you can paste a file name, a price or a snippet of code into the Find box without escaping anything.

Regex mode treats the Find box as a JavaScript regular expression, which is what lets you change a whole pattern at once. The replacement can reuse parts of the match:

  • $1, $2 and so on insert the text of a group. $<name> does the same for a named group.
  • $& inserts the whole match, and $$ inserts a dollar sign.
  • \n and \t insert a line break and a tab.

For example, find (\d{4})-(\d{2})-(\d{2}) and replace with $3/$2/$1 to turn 2024-05-12 into 12/05/2024. In regex mode ^ and $ match at the start and end of every line, so find ^ and replace with > to quote each line. Windows (CRLF) and old Mac line breaks are read as plain line breaks first, so a loaded Windows file behaves the same way, and the result has plain (LF) line breaks.

Using several rules in order

Rules run from the top, and each one sees the text the previous rule produced. That makes cleanups easy to build: one rule to remove double spaces, one to fix a spelling, one to change a date format.

Order matters. If rule 1 turns a into b and rule 2 turns b into c, every a ends up as c. Use the arrows on a rule to move it, the checkbox to switch it off without deleting it, and the match count on each rule to see what it did.

A rule with an empty Find box is ignored. A rule whose regular expression is not valid is skipped, and the reason is shown on the rule, while the others still run.

Whole words, capital letters and step by step review

Whole word stops cat from matching inside concat or cats. A word here is a run of letters, accents, digits and underscores in any script, so it works for accented and non-Latin text. A hyphen is not part of a word, so cat also matches inside cat-like.

Match case is off by default, so find hello also finds Hello and HELLO. The replacement is inserted exactly as you typed it, so the capital letters of the original are not copied across.

Step through is for changes you do not trust to a blanket replace. Each match is shown with the text around it, and you choose Replace or Skip. Undo takes back the last choice, and the result is built from your choices without touching the text box until you choose Use as new text.

Why a regular expression can freeze a page, and the guard here

Some patterns take twice as long with every extra character. A nested repeat such as (a+)+$ on a long run of a letters followed by b is the classic case. This is called catastrophic backtracking, and in an ordinary page it freezes the browser tab until it finishes, which can be minutes or longer.

This tool runs every search in a separate worker. If one takes more than 3 seconds, the worker is stopped, the page stays responsive, and you see a message instead of a frozen tab. Plain rules are escaped before they are run, so they cannot trigger the problem.

Questions people ask

How do I replace a line break?

In plain mode, press Enter inside the Find box to type a real line break. In regex mode, write \n in the Find box, and use \n in the replacement when you want to insert one. Line breaks in a loaded Windows file are read as plain line breaks, so \n matches them too, and the result is saved with plain (LF) line breaks. To get Windows line breaks back, add a last rule in regex mode that finds \n and replaces it with \r\n.

Which regular expression syntax does it use?

The JavaScript syntax your browser runs. Matching is global, so every match is replaced, and case is ignored unless Match case is on. In regex mode ^ and $ match at each line. Lookahead and lookbehind work in current versions of Chrome, Edge, Firefox and Safari.

What counts as a whole word?

A run of letters, accents, digits and underscores in any language. Spaces, punctuation and hyphens end a word. So whole word cat matches in the cat, in cat. and in cat-like, but not in concat or cats.

Can I undo a replacement?

In replace all mode your original text stays in the text box and the result appears separately, so nothing is overwritten and you can change the rules freely. In Step through mode, Undo takes back the last choice and Start over clears all of them.

Why did my pattern stop after 3 seconds?

It was probably catastrophic backtracking, a repeat inside a repeat that takes twice as long with every extra character. Make the repeats more specific, anchor the pattern, or turn regex mode off if you only meant to find plain text.

Is my text uploaded anywhere?

No. Searching and replacing happen in your browser, in a worker on your own device. The text is not sent to a server and is not stored.

Guides that help

All Text guides →