Open Toolkit

Find and replace text

Replace words in a text, with a live match count and optional regular expressions.

Free, no sign-up, no credit card. Your files stay on your device.

How to find and replace text

  1. Paste your text into the first box, or open a text file.
  2. Type what to find and what to replace it with.
  3. Tick "Match capitals", "Whole words only", or "Regular expression" if you need them, and check the number of matches.
  4. Select "Copy the result", or "Use the result as your text" to make another change.

What to know

Plain search or regular expression

Without the Regular expression box ticked, what you type is searched for exactly as written, so a dot, a bracket or a dollar sign is just that character. What you type in Replace with is inserted exactly as written too, including a dollar sign.

Options

  • Match capitals makes Cat and cat different. Without it both are found.
  • Whole words only is for plain search. With a regular expression, use \b or similar in the pattern instead, and the box is switched off.
  • A regular expression is read with Unicode rules first, so \p{L} finds letters in any alphabet, and if the pattern isn't valid that way it is tried again with the older, looser rules.

Making several changes

Select "Use the result as your text" to put the changed text back in the first box and clear the two search boxes, then make your next replacement. Your original text isn't kept, so copy it somewhere first if you may want it back.

If something goes wrong

It says the regular expression isn't valid

Check for a bracket or parenthesis that isn't closed, a repeat sign with nothing before it, or a backslash at the end. If you meant to search for plain text, untick "Regular expression".

It says my pattern takes too long

Some patterns, especially ones with repeats inside repeats such as (a+)+, can take the browser a very long time on a long text. After two seconds the search is stopped, so the page keeps working and your text stays as it was. Simplify the pattern and try again.

Fewer matches than I expected

Check Match capitals and "Whole words only". A match across two lines needs a regular expression that includes the line break, such as \n.

I need to change words inside a PDF

PDF text can't be edited in place. Take the text out, make your changes here, and make a new PDF from it. Use PDF to text.

Questions

Is my text uploaded?

No. The search and the replacing happen in your browser. Nothing is sent anywhere or saved, and your own text stays as it was until you choose to use the result.

Does it replace every match?

Yes, every match in the text. The line under the boxes says how many were found. To change only some of them, make the search more specific, or tick "Whole words only".

What does Whole words only do?

It skips a match inside a longer word, so finding cat leaves catalog and bobcat alone. A letter, a digit or an underscore next to the match makes it part of a longer word. It works with letters of any alphabet.

How do I use a regular expression?

Tick "Regular expression" and write the pattern in JavaScript's style. In Replace with, $1 and $2 stand for the groups in your pattern and $& for the whole match. For example, searching (\d+)-(\d+) and replacing with $2-$1 swaps the two numbers. The pattern is applied to the whole text, and ^ and $ match at every line.

What if my regular expression is wrong?

The page says so under the boxes, with the reason the browser gives, and leaves your text unchanged until the pattern is valid.

Something not working? Report a problem