Tools

Find and Replace

Find and replace text, with regex support

How to find and replace text

  1. Paste your text into the box.
  2. Type what to find and what to replace it with. Matches are highlighted below and counted as you type.
  3. Add more rules with + Another rule to make several replacements in one go, for example to rename a product and update a date at the same time.
  4. Choose Match case or Whole words if needed, press Replace all, then copy the result. Undo restores the previous version.

Using regular expressions

Tick Regular expressions for pattern-based replacements. Use \d+ to match numbers, \s+ for runs of whitespace, ^ and $ for line starts and ends (lines are matched as one text), and capture groups with $1, $2 in the replacement. For example, find (\d{4})-(\d\d)-(\d\d) and replace with $3/$2/$1 to turn ISO dates into day/month/year. Use the Regex Tester for building more complex patterns.

Without regular expressions, special characters such as ., * and $ are matched literally, and the replacement text is inserted exactly as typed. Whole-word matching understands letters in any language, so "cat" will not match inside "catalogue" or "über-cat".

All replacing happens in your browser, so it is safe for confidential documents and code.

How do I replace line breaks?

Tick Regular expressions and find \n. Replace with a space to join lines, or with , to make a comma-separated list.

Are the rules applied in order?

Yes, top to bottom. A later rule can change text produced by an earlier one.

Can I delete text instead of replacing it?

Yes. Leave the replacement box empty and every match is removed.