OnlineNotes Logo

    Find and Replace Text

    Replace every copy of a word or pattern in one go. Match case or whole words, or switch to regular expressions, and see the match count as you type.

    Options

    About this tool

    Find and replace is one of those jobs that needs a real editor, and often you do not have one to hand: you are on a phone, on a shared machine, or holding text copied from a web form. This works anywhere and shows the number of matches before you copy anything, so you can tell whether the pattern caught what you meant.

    Whole-word matching is what stops "cat" from changing "category". Regular expressions handle the jobs a plain search cannot, such as swapping names around or removing the numbers at the start of each line. The regex tester on this site is a good place to work out a pattern first.

    How it works

    1. Paste your text, then type what to find and what to put in its place.
    2. The match count and the output update as you type. Your input text never changes.
    3. Turn on "Match case" or "Whole words only" to narrow the matches.
    4. For patterns, turn on "Regular expression". Use $1 and $2 for groups, and \n for a new line.

    Worked example

    Input

    Smith, Anna
    Jones, Ben

    Output

    Anna Smith
    Ben Jones

    In regex mode, find (\w+), (\w+) and replace with $2 $1. Each group holds a name, and the replacement puts them back in the other order.

    Edge cases and limits

    • Whole-word mode uses word boundaries, which work for English letters and digits. Use regex mode for other scripts.
    • Whole-word mode is ignored for regular expressions. Add \b to your pattern yourself.
    • An invalid pattern shows a message and leaves the text unchanged.
    • To match across line ends in regex mode, use \n in the pattern. The dot does not match a new line.

    Frequently asked questions

    Does replacing change my original text?

    No. Your text stays in the input box, and the result goes to the output box, so you can try again freely.

    Can I replace text with nothing to delete it?

    Yes. Leave "Replace with" empty, and every match is removed.

    Can it replace line breaks?

    Yes. Turn on "Regular expression", then put \n in the Find box. Or use the remove line breaks tool.

    Related tools