Skip to content

Find and Replace Text

Replace words or regex patterns in text, with live highlights. Runs in your browser.

Loading tool…

About this find and replace text

This tool finds every copy of a word, phrase or pattern in your text and replaces it in one pass. It is for writers, editors and developers who need a bulk edit without opening Word or a code editor.

The result updates as you type, with every replacement highlighted. Plain text mode matches exactly what you type, so $, + and ( need no escaping. Regex mode takes JavaScript regular expressions, with $1 and $<name> in the replacement.

Your text never leaves your browser. Regex runs in a background thread with a time limit, so a runaway pattern gets stopped. Your tab keeps working.

Features

  • Live preview with highlights

    The Result view marks every replacement, and deletions show as a thin red bar. Switch to Matches in text to see each hit in your original text.

  • Plain text that is really plain

    Search for $1.50 or C++ and you get exactly that. A $ in the replacement stays a $. No backslashes needed.

  • Capture groups in the replacement

    Use $1 to $99, $<name>, $& and $$. The rules follow String.prototype.replace in the ECMAScript standard, so what works here works in your code.

  • Step through matches

    Press Enter in the Find box to jump to the next match, or Shift+Enter to go back. A counter such as 3 / 12 shows where you are.

  • Line breaks without regex

    With the escape option on, \n means a line break and \t means a tab in both boxes. Joining 200 lines into one takes a second.

  • Keep letter case

    Replace colour with color and Colour becomes Color, while COLOUR becomes COLOR. Each replacement copies the capitals of the word it replaces.

  • A time limit on heavy patterns

    If a pattern runs for more than about 2 seconds, it is stopped. You get a plain explanation and a hint on how to fix the pattern.

How to use the find and replace text

  1. 1Paste your text or open a text file.
  2. 2Type what to find and what to replace it with. Pick Plain text or Regex and any options.
  3. 3Check the highlighted result, step through matches, then copy or download it.

When to use it

  • Fixing a name across a long draft

    Swap an old product name or a British spelling in one pass. Turn on Whole word so "cat" leaves "category" alone. Then compare the before and after if you want a second check.

  • Cleaning up pasted text

    Collapse double spaces, drop blank lines or rejoin lines that a PDF split mid-sentence. For lists, remove duplicate lines afterwards.

  • Reformatting data

    Turn 2026-03-14 into 14/03/2026, swap first and last names, or wrap each line in quotes for a SQL IN list.

How do regex replacement codes like $1 work?

In Regex mode the Find box takes a JavaScript regular expression, without the slashes around it. Each pair of parentheses captures part of the match, and the Replace box can put those parts back in any order. Named groups and lookbehind arrived in ES2018 and work in every current browser.

If you want to build a pattern step by step first, test it in the regex tester. Then paste it here to do the replacing.

  • $1 to $99: the text captured by the first, second or later group.
  • $<name>: the text of a named group such as (?<year>\d{4}).
  • $&: the whole match. Find \d+ and replace with [$&] to wrap every number in brackets.
  • $$: a literal dollar sign.
  • \n and \t: a line break and a tab, when the escape option is on.
  • Flag m: ^ and $ match at each line. Flag s: the dot also matches line breaks. Flag u: full Unicode, so an emoji counts as one character.

Why does a regex freeze the browser?

Your browser's regex engine backtracks. When a match fails, it tries another way to split the text between the parts of the pattern. Usually that's instant.

Some patterns have an exploding number of splits. The classic is (a+)+$ run on a line of a's that ends in b. Each extra a roughly doubles the work. At 30 characters that is about a billion attempts. This is called catastrophic backtracking.

Here the pattern runs in a background worker. If it takes too long, the worker is shut down and your page stays usable. To fix the pattern, remove nested quantifiers like (x+)+. Also swap a broad .* for something narrower, such as [^,]* when you mean everything up to the next comma.

When should you use plain text instead of regex?

Use plain text when you know the exact words. Dots, brackets and dollar signs mean themselves, and Whole word plus Match case cover most jobs. Need just the capitals changed? Change the letter case instead.

Use regex when the target follows a pattern: any date, any email, any run of spaces. Start from an example and watch the count.

Why use Mavros

 MavrosTypical upload sites
Where your text goesStays in your browserOften processed next to ads and trackers, sometimes sent to a server
Slow or broken regexStopped after a time limit with an explanationThe tab freezes until you close it
Literal search for $, + or .Plain text mode matches them exactlyOften treated as regex, so the search fails
Line breaks without regex\n and \t escapes in plain modeUsually regex only
Jump between matchesPrev and Next, or Enter and Shift+EnterRarely available
Per-match previewMatch list with groups and the replacementOnly the final text

Tips

  • Check the match count before you copy. If it is higher than you expected, turn on Whole word or Match case.
  • Leave Replace with empty to delete every match.
  • Use result as input to chain several replacements. Undo goes back one step.
  • Editing JSON by hand? Replace first, then check that the JSON is still valid.

Questions

How do I find and replace text online?

Paste your text, type the word in Find and the new text in Replace with. The result updates as you type, and you can copy it or download it as a .txt file.

How do I replace line breaks?

Type \n in the Find box with the escape option on, then put a space or a comma in Replace with. This works in plain text mode, so you don't need regex.

How do I use capture groups like $1?

Wrap the parts you want to keep in parentheses, then refer to them as $1, $2 and so on. In Regex mode, find (\w+) (\w+) and replace with $2 $1 to swap two words. Named groups use (?<name>…) and $<name>.

How do I replace only whole words?

Turn on Whole word. Then cat matches cat but not concat or category. It understands accented letters and non-Latin scripts too, unlike a plain \b in a regex.

Why did my regex stop with a backtracking message?

It ran past the time limit, usually because nested quantifiers such as (a+)+ try a huge number of ways to match. Make the pattern more specific and it will run normally.

Is the search case sensitive?

No, not by default. Turn on Match case to treat The and the as different. Keep letter case then copies the capitals of each match into its replacement.

Is my text uploaded anywhere?

No. All searching and replacing happens in your browser, and nothing is sent to a server.