text tool

Find and replace online

Paste your text, type what to find and what to put in its place, and the result appears beside it with every match highlighted and counted. Plain text mode matches exactly what you type, and regex mode adds patterns, capture groups and line anchors.

Loading the tool…

How it works

  1. 1

    Paste the text

    Put it in the Your text box. The line count beside the label confirms the whole paste arrived.

  2. 2

    Type what to find and what to replace it with

    With Use regex off, the Find box matches the characters exactly. Tick Match case or Whole words only to narrow it.

  3. 3

    Switch on regex for patterns

    Tick Use regex to write patterns such as \d{4}. Two more switches unlock: ^ and $ match each line, and Dot matches line breaks.

  4. 4

    Check the highlights, then copy

    The left pane marks every match and the status line counts them. Copy the result, download it, or press Use the result as the text for another pass.

Plain text first, regex when you need it

Most find and replace jobs are literal: a renamed product, a changed phone number, a typo repeated through a long draft. In plain text mode every character in the Find box means itself, so a full stop is a full stop and a dollar sign is a dollar sign, and the replacement is written exactly as typed. Whole words only stops cat from matching inside category, and it treats letters with accents as letters, so café is a whole word too. Match case is off by default because most people searching for a name want every capitalisation of it. The highlighted pane is the check: read it before you copy, because a match you did not expect is much easier to spot in place than in a count.

Capture groups turn find and replace into reformatting

Regex mode is where the tool does more than a word processor. Brackets in the pattern capture what they match, and $1, $2 and so on put it back in the replacement in any order. The example button turns ISO dates such as 2026-09-14 into 14/09/2026 with the pattern (\d{4})-(\d{2})-(\d{2}) and the replacement $3/$2/$1. Named groups work too: (?<year>\d{4}) is reused as $<year>. $& stands for the whole match, so wrapping every price in bold is a pattern for the price and **$&** as the replacement. Typing \n or \t in the replacement inserts a real line break or tab, which is how you split a comma separated list onto separate lines.

Why the line switches matter

By default ^ means the start of the whole text and $ the end of it, so ^ followed by a word only finds the very first line. Tick ^ and $ match each line and they anchor to every line instead, which is what you want for adding a bullet to each line or trimming a prefix from a pasted list. A dot normally stops at a line break; Dot matches line breaks lets one pattern span paragraphs, which is useful for removing a block that starts and ends with known words. Both switches only appear active in regex mode, because in plain text mode those characters are matched literally.

A pattern cannot freeze the page

Some patterns take exponential time on the wrong text. Nested repeats such as (a+)+ or (.*)* make the regex engine try every way of splitting the input before giving up, and on a few thousand characters that can lock a browser tab for minutes. The search here runs in a background worker. If it has not finished in 2.5 seconds, the worker is stopped and replaced, the page stays responsive, and a message suggests a more specific pattern such as [^,]+ instead of .+. Typing a new character while a slow search runs cancels it straight away.

Limits worth knowing

This is the JavaScript flavour of regex, the one in every browser. Patterns copied from PHP, Python or .NET mostly work, but inline flags such as (?i), possessive quantifiers and atomic groups do not, and the error message says the pattern cannot run rather than silently matching something else. Lookbehind needs a browser from 2023 or later. Replacements are made in one pass over the original text, so a replacement is never searched again. Nothing is uploaded and nothing is stored, ever: refresh the page and every box is empty.

Limits

  • Patterns follow the JavaScript regex flavour. Possessive quantifiers, atomic groups, recursion and inline flags such as (?i) from PCRE or .NET are not supported.
  • Lookbehind, the (?<= group and its negative twin, works in current Chrome, Edge, Firefox and Safari 16.4 or later. An older browser says it cannot run the pattern rather than guessing.
  • A pattern that runs for more than 2.5 seconds is stopped, which is what catastrophic backtracking from nested repeats such as (a+)+ looks like.
  • The first 5,000 matches are highlighted. The count and the replacement cover every match.

What it does not do

  • It does not edit files on your computer or in a folder. It works on the text in the box.
  • It does not keep a history of replacements. Use the result as the new text to chain several passes, and keep a copy of the original.
  • It does not upload or store your text or your pattern.

Questions people ask

How do I replace text with a line break?

Turn on Use regex, then type \n in the Replace with box where the break should go. For example, finding a comma followed by a space and replacing it with \n puts every item of a comma separated list on its own line. \t inserts a tab the same way. In plain text mode those characters are written literally, so the switch has to be on.

Why does my regex from Python or PHP not work here?

Each language has its own flavour. This tool uses the JavaScript one, which has no inline flags such as (?i), no possessive quantifiers and no atomic groups, and writes named groups as (?<name>...) rather than (?P<name>...). Use the Match case switch instead of an inline flag. Most character classes, anchors, groups and lookahead behave the same, so many patterns move over unchanged.

Can I undo a replacement?

Your original text is never changed. It stays in the Your text box, and the result sits in its own pane, so changing the pattern or clearing the replacement shows the original again. Only the Use the result as the text button overwrites the input, and that is a deliberate step for chaining passes. Copy the original somewhere first if you plan to chain several.

How do I find a word only when it stands alone?

Tick Whole words only. It requires that the match is not touching another letter, number or underscore on either side, so cat finds the word cat but not category or bobcat. Accented letters count as letters, which plain \b boundaries in older tools get wrong. In regex mode the switch wraps your whole pattern, so it also works with alternatives such as cat|dog.

What does an empty match mean?

Some patterns can match zero characters, such as a* or a lone ^ with the line switch on. Each empty match is a position rather than a piece of text, so the replacement is inserted there. The highlighted pane shows those positions as thin bars, and a note appears when any match is empty. Adding a prefix to every line uses exactly this behaviour on purpose.

Turn the cleaned text into a document

Take what you made here into documents.

Create a document with OneCraft

More tools like this

Background reading: the question page on this.

Sources

Written and checked by the OneCraft team. Last checked .