toolready. Find & Replace

Find & Replace

Search and replace text — plain or regex, with a live count.

0 matches

What this does

A find-and-replace box for text you paste in, with a live match count so you can see how many hits a pattern has before you commit to changing them. Three checkboxes control the search: Regex, Case-sensitive and ^ $ per line (multiline). Replace all rewrites the text area in place; Copy puts the result on the clipboard and Clear empties all three fields. Everything runs on the native JavaScript regex engine in your own browser, so the text stays on your machine.

How do I replace every occurrence at once?

  1. Paste your text into the large box.
  2. Type the search term in Find — the counter on the right updates immediately, reading e.g. 3 matches or 1 match.
  3. Type the substitution in Replace with. Leave it empty to delete the matches.
  4. Click Replace all. Every match goes at once; there is no step-by-step or single-replace mode.

The replacement is destructive and there is no undo button, so if the text matters, copy it out first — or check the match count and adjust the pattern until it is the number you expect.

Is the search case-sensitive by default?

No — the opposite of most editors. The search runs with the i flag unless you tick Case-sensitive, so foo matches Foo and FOO out of the box. The starting sample text contains both "quick" and "QUICK" to make that behaviour obvious: searching quick reports 2 matches until you tick the box, then 1. The g flag is always on, so a replace never stops at the first hit.

When should I turn on regex mode?

With regex off, your search term is escaped before use — ., *, ( and the rest are matched literally, so searching . in a.b.c hits exactly the two dots. With it on, the term is passed to the engine untouched and you get the whole JavaScript syntax: character classes, quantifiers, \b word boundaries, lookahead, named groups. Capture groups referenced as $1, $2 in the replacement are what make it worth the trouble:

find     (\w+)@(\w+)\.com     regex on
replace  $1 at $2
input    ada@example.com
output   ada at example

A malformed pattern such as (unclosed shows the engine's error message next to the buttons and leaves your text alone. Note that $ in the replacement field is special in both modes — to insert a literal dollar sign, write $$.

What does the multiline checkbox change?

It adds the m flag, which redefines ^ and $ to mean the start and end of each line rather than of the whole block. Without it, ^TODO matches only if the very first line starts with TODO; with it, every such line matches. It pairs naturally with regex mode — use it for jobs like stripping a leading marker from each row (^> → nothing) or appending to every line.

What else is this useful for?

Reformatting a column of values pasted out of a spreadsheet, quoting a list for a SQL IN clause, stripping timestamps out of a log before sharing it, or normalising delimiters in a CSV. If you want to build and test the pattern first with a live view of every match and its capture groups, do that in the regex tester and paste it back here. For neighbouring cleanups there is whitespace cleanup, sort and dedupe lines, and the case converter.