MateenLabs No ads · Runs in your browser
Free Text Tool

Find and Replace Text

Paste your text, say what to find and what to put in its place, and see the matches highlighted before you change anything. Replace everything at once, or step through the matches one at a time and decide on each. You can add more rules, and they are applied in order, one after another.

Use plain text for everyday edits or switch on regular expressions for patterns, with $1, $2 and $& in the replacement. Patterns run in a background worker with a time limit, so a pattern that would take forever stops with a message and never freezes the page. Your text is not uploaded.

Free Forever No Login No File Uploads Browser Processing
0 characters
0 characters
Search with
Options

Find and replace rules

    Matches of rule 1 in your text

    Paste your text and type what to find.

    Plain text, regular expressions and rules

    In plain mode, what you type in Find is searched for exactly, and characters such as . * ( [ have no special meaning. You can match upper and lower case exactly, or only whole words. With whole-word matching, letters and numbers in any language count as parts of a word, so "caf" does not match inside "café". The option to read \n and \t lets you search for or insert a line break or a tab.

    In regular-expression mode the Find box is a JavaScript pattern. In the replacement, $1, $2 and so on stand for the parts of the match captured by brackets, $& is the whole match, $$ is a dollar sign and $<name> is a named group. For example, finding (\w+) (\w+) and replacing with $2 $1 swaps two words. The multiline option makes ^ and $ match at every line instead of only at the start and end of the text.

    You can add several rules. They run from top to bottom, and each rule works on the result of the one before it. The highlighted preview and the step-by-step buttons use the first rule. Some patterns, such as nested repeats like (a+)+, can take an extremely long time on some text. Every search has a time limit and is stopped with a clear message when it is reached.

    • Plain text or regular expressions, with match case, whole word and multiline options.
    • Live match count and a highlighted preview of the first rule.
    • Replace all, or step through the matches with Find next and Replace.
    • $1, $2, $& and named groups in regular-expression replacements.
    • Several rules applied in order, and \n and \t in plain text.
    • Slow patterns are stopped by a time limit, and errors in a pattern are explained in plain words.

    How to use the Find and Replace

    1. Paste your text in Your text.
    2. Type what to find and what to replace it with. Choose plain text or regular expression, and the options.
    3. Check the highlighted preview and the count. Add more rules if you need them.
    4. Read the result, then press Copy result or Download .txt. To change one match at a time, use Find next and Replace this match.

    Is it private?

    Yes. Your text and your rules stay in your browser tab. They are not uploaded, not sent to any service and not stored. Searches run in a background worker that is loaded from this site and that is stopped if a pattern takes too long.

    Read our tools privacy policy →

    Frequently asked questions

    How do I use $1 in the replacement?

    Turn on regular expressions and put brackets around the part you want to reuse. In the find pattern (\d+)-(\d+) the first bracket is $1 and the second is $2, so replacing with $2-$1 swaps the two numbers. $& is everything the pattern matched. In plain mode the replacement is used exactly as typed.

    Why does it say my pattern took too long?

    Some patterns make the browser try a huge number of ways to match, especially nested repeats like (a+)+ followed by something that fails. To keep your page responsive, each search runs in the background and is stopped after a few seconds. Make the pattern more specific, for example by anchoring it or removing the nested repeat. Some browsers, Safari for example, stop such patterns by themselves and then report no matches, so if a pattern finds nothing when you expect matches, try a simpler one.

    What does whole word mean for other languages?

    Whole word treats any letter or number in any script as part of a word, plus the underscore. So searching for "cat" does not match inside "cats" or "catégorie", but it does match in "the cat." and "cat's" (because the apostrophe is not part of a word).

    Can I replace several things at once?

    Yes. Press Add another rule and fill in a second find and replace pair. The rules run from the first to the last, and each one works on the output of the one before it. The result box shows the final text and the summary shows how many matches each rule found.

    What happens to my text?

    It stays in your browser. Searching and replacing run in a background worker loaded from this site, and your text is not uploaded or stored.

    Related tools