Skip to content

Find and Replace

Search a block of text and replace every occurrence, as plain text or with a regular expression and capture groups.

Processed locally in your browser

Options
0 chars · 0 lines
The result will appear here.

What is Find and Replace?

Find and Replace swaps every occurrence of a word, phrase or pattern in your text. In plain mode the search is literal, with options for matching case and whole words only, so "cat" does not change "concat". The replacement is inserted exactly as typed.

Regex mode accepts JavaScript regular expressions: capture groups can be reused in the replacement as $1, $2 or $<name>, and \n and \t become a line break and a tab. ^ and $ match at every line. Regex mode runs in a background worker with a time limit, patterns are limited to 500 characters, and patterns prone to catastrophic backtracking are refused. The number of replacements is reported.

How does it work?

  1. Paste your text, then type what to find and what to replace it with.
  2. Choose match case and whole words, or tick regular expression to use patterns and groups such as (\d+)-(\d+) → $2-$1.
  3. Read the replacement count in the notes and copy the result.

Common use cases

  • Renaming a variable, product name or URL across a pasted document.
  • Reformatting dates from 2024-01-15 to 15/01/2024 with regex groups.
  • Turning a comma-separated line into one item per line by replacing "," with \n.
  • Removing unwanted words or characters from a text in one pass.

Examples

Try this input in the tool above:

2024-01-15, 2024-02-20, 2024-03-05

Privacy

Find and Replace runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.

Limitations

Regex syntax is JavaScript’s (no lookbehind on very old browsers, no PCRE-only features). For advanced tests use the Regex Tester first.

Frequently asked questions

How do I reuse part of the match?

Enable regular expression, wrap the part in parentheses and write $1 (or $<name> for named groups) in the replacement.

Why was my regex refused?

It is longer than 500 characters, invalid, or has nested repetition such as (a+)+ that could freeze your browser. Simplify the pattern.

How do I insert a line break?

Type \n in the replacement (the "read \n and \t" option is on by default).

More tools in Text Tools →