Find and replace text
Find and replace text, as plain text or with regular expressions (capture groups, flags), with a count of replacements.
0 / 2,000,000 characters · Updates as you type.
Paste text, type what to find and what to replace it with, and the result updates as you type, with the number of replacements made. Plain-text mode finds the exact characters you type (dots, brackets and dollar signs included) and inserts the replacement literally. Options restrict matches to whole words (Unicode-aware, so it works for accented and Arabic words too) and control case sensitivity and whether every match or only the first is replaced.
Regular-expression mode uses JavaScript regex syntax with Unicode enabled: \d, \s, \p{L} for any letter, lookarounds, and named groups. In the replacement, $1 or $<name> inserts a captured group and $& the whole match, so find (\w+)@(\w+) and replace with $2 at $1 swaps parts of an address. The m and s flags are available as options.
A badly written pattern can take exponential time on some inputs (catastrophic backtracking). Like the regex tester on this site, regex replacements run in a Web Worker that is stopped after 2 seconds, so the page never freezes. The text never leaves your browser.
How to use it
- Paste the text to edit into the box.
- Type the text or pattern to find and its replacement; choose plain text or regular expression.
- Set match case, whole words and replace-all as needed; the result and the replacement count update live.
- Copy the result or download it as a .txt file.
Frequently asked questions
How do I delete every occurrence of a word?
Type the word in Find, leave Replace with empty, and keep "Replace all" on. Turn on "Whole words only" so that, for example, "cat" does not remove the start of "catalogue".
How do I use capture groups?
Switch to regular expression mode, wrap parts of the pattern in parentheses, and refer to them as $1, $2 ... in the replacement. Named groups (?<year>\d{4}) are inserted with $<year>.
Can I insert a line break in the replacement?
The replacement field is a single line, so to join or split lines use a regex that matches the line break (\n) in Find instead.
Why did my pattern stop with a timeout?
It probably has nested quantifiers such as (a+)+ that backtrack exponentially. Simplify the pattern; the 2-second limit protects the page.
Related tools
- Test a regular expressionTest a JavaScript regular expression against text with highlighted matches, capture groups and a timeout guard.
- Compare text (diff checker)Compare two texts line by line or word by word and see additions and deletions side by side or inline.
- Case converterConvert text to UPPER, lower, Title Case, Sentence case, camelCase, PascalCase, snake_case, kebab-case or CONSTANT_CASE.
- Remove extra spaces and blank linesTrim lines, collapse repeated spaces, remove or collapse blank lines, convert tabs and spaces, and strip invisible characters.
- Remove duplicate linesDelete repeated lines from a list, keeping the first or last occurrence, with case-sensitivity and trimming options.