Pular para o conteúdo
Tool

Search and Replace Text

Advanced tool for searching and swapping words in large blocks of text, including Regex (Regular Expressions) support.

What it is

Find and Replace does to a block of text what the same command does inside an editor, except that you can paste anything in, run it in the browser, and never open a program.

It handles plain search and replace, and it also accepts regular expressions, which is what turns it from a convenience into a real tool.

How to use it

  1. Paste your text.
  2. Type what to find and what to put in its place.
  3. Turn on the options you need: case sensitivity, whole word only, or regex.
  4. Copy the result.

What regular expressions add

Plain replace only matches text you can type out. A regular expression matches a pattern, which is what you need when the thing you are replacing is not always the same string.

A few that come up constantly:

  • \s+ collapses runs of spaces, tabs and line breaks.
  • ^\s+|\s+$ with multiline trims every line at once.
  • \d{2}/\d{2}/\d{4} finds dates in day/month/year form.
  • (\w+)@(\w+) captures the two halves of an email, so $1 and $2 can rebuild it differently.

The capture group is the part worth learning: anything in parentheses can be referred to in the replacement, which is how you reorder rather than just substitute.

Nothing is uploaded

The whole operation runs in your browser, so the text you paste never reaches a server and is never stored. That is worth knowing before pasting a log, a customer list or anything else you would not post publicly.

For counting rather than changing, use the line counter or the character counter. To remove duplicate lines, use the duplicate line remover.

Frequently asked questions

Does it support regular expressions?

Yes. Turn on the regex option and the search field accepts a pattern instead of literal text, including capture groups you can refer to in the replacement as $1, $2 and so on.

How do I replace several spaces with one?

Turn on regex, search for \s+ and replace with a single space. That collapses any run of spaces, tabs and line breaks into one.

Can I match whole words only?

Yes, there is an option for it. Without it, searching for "cat" would also change "category"; with it, only the standalone word is replaced.

Can I undo a replacement?

The original stays in the input box, so nothing is destroyed: the result appears separately and you copy it when you are satisfied. Replacing over your only copy of something is still a bad habit worth avoiding.

About this content

Written by:
Ferramenta Grátis

Related tools