Find and Replace Text
Replace text in bulk with a plain search or a regular expression.
- Runs in your browser
- Nothing is uploaded
- Free, no sign-up
About this tool
Replace every occurrence of a word, phrase or pattern in a block of text. Search for fixed text with whole-word and case options, or switch to regular expressions and rearrange what you find with capture groups. The work is done in your browser.
How to use it
- Paste your text or open a file.
- Type what to find and what to replace it with, and choose plain text or regular expression.
- Check the match count, then copy or download the result.
Plain text or regular expression
In plain text mode what you type is taken literally. A full stop, a dollar sign or a bracket is just that character, so you can replace (approx.) or $5.00 without escaping anything.
In regular expression mode the search is a pattern:
| Find | Replace with | Does |
|---|---|---|
(\d+)-(\d+)-(\d+) |
$3/$2/$1 |
Rewrites 2024-07-01 as 01/07/2024 |
<[^>]+> |
(nothing) | Strips HTML tags |
{2,} |
|
Collapses runs of spaces |
^ |
> |
Adds a prefix to every line |
\s+$ |
(nothing) | Trims trailing whitespace |
The replacement string
In regular expression mode, the replacement understands a few special forms:
$1,$2and so on insert the text matched by that group.$&inserts the whole match.$<name>inserts a named group.$$is a literal dollar sign.
In plain text mode none of these apply, so a replacement containing $1 is inserted exactly as typed.
Whole words, line breaks and tabs
Whole words only stops cat from changing concat or cats. It uses boundaries that understand letters outside English, so café is treated as one word, and digits and underscores count as part of a word.
Tick Read \n and \t as line break and tab to type those escapes into the find or replace fields. Replacing , with \n turns a comma-separated list into one item per line, and the reverse is the same swap.
When a pattern is too slow
Some regular expressions take exponentially longer as the text grows, because the engine tries every way of dividing it up. In an ordinary page that freezes the tab.
Patterns here run in a background worker with a two-second limit. If one exceeds it, it is stopped and you are told, and the page stays responsive. The usual cause is nested repetition such as (a+)+. To experiment with a pattern and see every match, use the regex tester.
Frequently asked questions
Does it replace every match or only the first?
Every match. To change just one occurrence, make the search text specific enough that only that occurrence matches, or edit it by hand.
Is the search case sensitive?
Not by default. Tick Match case to make it so.
Which regular expression flavour is used?
JavaScript's, with Unicode mode on and ^ and $ matching at the start and end of each line. Lookbehind and named groups are supported.
Is my text sent to a server?
No. Searching and replacing happen in your browser, and the text is never uploaded.
Related tools
Regex Tester
Test regular expressions with live match highlighting and groups.
Remove Duplicate Lines
Delete repeated lines from a list while keeping the original order.
Sort Lines Alphabetically
Sort a list of lines A to Z, naturally, by number or by length.
Text Case Converter
Convert text between camelCase, snake_case, kebab-case and more.