Find and Replace

Replace every match, as plain text or a regular expression

About Find and Replace

Find and Replace swaps every occurrence of a search term in your text for a replacement in one pass, shows the result in a separate box and says how many replacements were made. By default, the search and the replacement are plain text, so characters such as . ( ) and $1 mean themselves. Check Use regular expression for JavaScript patterns with capture groups, Ignore case to match any case, and Whole words only to skip matches inside longer words, in any alphabet except for a regex that the Unicode mode refuses, where only the common scripts count. Your original text is not changed, and your text never leaves your device.

Example

Plain text with "Ignore case" and "Whole words only" checked: USDT is left alone and the $ is inserted as typed. The page shows 2 replacement(s) made.

Text (Find: USD, Replace with: US$)

Total: 5 USD. Tax: 1 usd. USDT is not a match.

Result

Total: 5 US$. Tax: 1 US$. USDT is not a match.

How to find and replace text

  1. 1Paste your text into the first box.
  2. 2Fill in "Find" and "Replace with"; leave "Replace with" empty to delete every match.
  3. 3Check "Use regular expression", "Ignore case", or "Whole words only" if needed.
  4. 4Click "Replace all", check the count, then click "Copy" or "Download" to keep replaced.txt.

Formats and limits

Search modes
Plain text (default) or JavaScript regular expression
Options
Ignore case; Whole words only (letters, digits, and marks of any script)
Regex flags
g always; i with Ignore case; u with Whole words only, except for a pattern the u flag refuses, which then runs without it; never m or s
Output
A separate Result box with the count; Copy, or Download as replaced.txt

Where your text is processed

Matching and replacing use your browser's own regular-expression engine; your text is never uploaded. When a regular expression is invalid, the error shown on the page is reported to our error log with the tool name and browser version, and that error can contain part of your pattern.

Frequently asked questions

Is the search case-sensitive?

Yes, by default: USD does not match usd. Check "Ignore case" to match both. In plain-text mode the replacement is still inserted exactly as you typed it, whatever the case of the match.

Can I use capture groups like $1?

Yes, with "Use regular expression" checked: $1 inserts the first captured group and $& the whole match, as in JavaScript. Without regex mode, $1 and $& are inserted literally, so a price written as US$ stays intact.

Do ^ and $ match the start of each line?

No. The pattern runs without the multiline flag, so ^ matches only the very start of the text and $ only its end. To act on each line, match the line break itself, written \n in regex mode. The replacement field cannot insert a line break.

Does Whole words only work with accented and non-Latin words?

Yes. A match is skipped when a letter, digit, combining mark, or underscore of any script touches it, so café is not found inside cafés. One exception: a regex the Unicode mode refuses, such as a\-b, falls back to the letters of the common scripts only.

Can I undo a replacement?

Yes, in effect: your original text stays unchanged in the first box and the result goes to a separate box. Change the options and click "Replace all" again for a new result.

Tips and tricks

  • ✓Build and test a complex pattern in Regex Tester first, then paste it into the Find field here.