Text Transform

Find and replace

What to do

Transformed in your browser · nothing is uploaded

Local · plain mode escapes your search string

Replaces every match as you type. Plain text by default, with a checkbox for regular expressions and capture groups usable as $1 and $2, and another for case-sensitive matching. The bulk option takes a list of find | replace pairs, one per line, and applies all of them in a single pass, in order.

How to use the find and replace

1 Paste the text into the first box.
2 For one replacement, fill in Find and Replace with. The result updates as you type.
3 For a whole list, choose Replace all pairs and put one "find | replace" on each line of the pairs box.
4 Tick Regular expression if you need a pattern rather than a literal string, and Case sensitive if the capitals matter.
5 Copy the result, or save it as a text file.

Plain-text mode escapes your search string, which is the behaviour people expect and most tools get wrong: searching for a full stop should find full stops, not match every character as a regex wildcard would. Ticking Regular expression gives you the full pattern language, with capture groups available in the replacement as $1, $2 and so on, and \n to match a line break so a replacement can cross lines. Matching ignores case in both modes until you tick Case sensitive, which is the setting to reach for when you are renaming a variable, an identifier or anything else where Order and order are two different things. One deliberate behaviour worth knowing: an invalid regular expression leaves the text unchanged rather than showing an error, because you are typing the pattern one character at a time and every incomplete pattern would otherwise be an error state.

The bulk option exists because a glossary of substitutions — renaming twenty terms, anonymising a set of names, applying a house style — is not twenty visits to a find box. It reads one pair per line, split on the first pipe, and skips any line without one. The case-sensitive setting applies to every pair in the list; regular expressions do not, and belong to the single replacement, where you can see what the pattern is doing.

The trap in any bulk replacement is that the pairs run in order, so an earlier replacement can be found again by a later one. Replacing a with b and then b with c turns every original a into c, which is almost never what was intended and is the source of most surprises here. There are two ways round it: order the pairs so no replacement value appears in a later find, or replace into placeholders in a first pass and resolve the placeholders in a second. Neither is clever, and one of them is always available.

What people use it for

  • Applying a whole glossary of term substitutions to a document in one pass
  • Anonymising a support ticket by swapping every real name for a placeholder
  • Renaming a product across a page of copy without opening an editor
  • Deleting a repeated prefix from a pasted list by replacing it with nothing
  • Reformatting dates or reference codes with a pattern and its capture groups
  • Applying a house-style rule across a draft before it is filed

Questions

Only if you tick Case sensitive. Matching ignores case by default, and the setting applies to the bulk pairs as well as the single replacement.

MDN, regular expressionsMDN, String.prototype.replaceAll
Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding