Find and Replace Online — Batch Rules and Regex
Batch replace text with an ordered list of rules and per-rule counts
Runs in your browser · nothing is uploaded
Replace rules (applied top to bottom)
Rule 1
Rule 2
What it is
Most editors let you find and replace one thing at a time. Cleaning up real text usually takes several passes: fix the date format, rename a product, collapse double spaces, swap straight quotes. This tool keeps all of those passes as a list of rules and runs them in one go, top to bottom, every time you edit the text or a rule.
Each rule shows how many replacements it made, and a summary line gives the total, so a rule that matched nothing (or far too much) stands out straight away. Rules can be plain text or JavaScript regular expressions with capture groups, and the whole-word option understands every script, not just English. The page opens with a short sample and two rules so you can see the result before typing anything.
How to use
- Paste your text into the Text box.
- For each rule, fill in Find and Replace with, then tick Regex, Match case or Whole word as needed.
- Press Add rule for more rows (up to 20) and the ✕ button to drop one.
- Check the count next to each rule title and the total above the result.
- Copy the result when it looks right.
How it works
- Order: rules run from top to bottom and each one works on the previous output. Rules with an empty Find are skipped.
- Plain mode: Find is matched literally and every occurrence is replaced. A $ in the replacement is inserted as a dollar sign.
- Match case: off by default, so upper and lower case are treated alike (using Unicode case folding).
- Regex mode: JavaScript syntax with the g, m and u flags. ^ and $ match at the start and end of every line, and . matches any single character except a line break, including a whole emoji. In the replacement, $1 and $2 insert groups, $
a named group, $& the whole match and $$ a single dollar sign. - Whole word: a match only counts when the character right before and right after it is not a Unicode letter, combining mark, digit or underscore. It works with regex rules too.
- \n and \t (on by default): in replacements and in plain-mode Find, \n becomes a line break, \t a tab and \ one backslash; other backslashes are kept. A regex Find keeps ordinary regex escapes.
- Safety: everything runs in a Web Worker with a 2-second limit; the result refreshes 250 ms after you stop typing.
- Limits: 200,000 characters of text, 20 rules, 1,000 characters per Find or Replace field and 1,000,000 characters of output.
Examples
| Text | Rule | Result |
|---|---|---|
| Starts 2026-10-05 | Regex (\d{4})-(\d{2})-(\d{2}) → $2/$3/$1 |
Starts 10/05/2026 |
| cat catalog (cat) | cat → dog, whole word | dog catalog (dog) |
| Cat cat CAT | cat → dog, match case | Cat dog CAT |
| price 1.5 | 1.5 → $1 (plain) | price $1 |
| a, b, c | , → \n |
a, b and c on separate lines |
| apple | apple → pear, then pear → plum | plum |
FAQ
In what order are the rules applied?
Top to bottom. Each rule searches the output of the rule above it, so if rule 1 turns apple into pear and rule 2 turns pear into plum, the original apple ends up as plum. Reorder by editing the rows when the order matters.
How do I put a literal dollar sign in the replacement?
With Regex off, the replacement is used exactly as typed, dollar signs included. With Regex on, $1, $<name> and $& are references, so write $$ for a single dollar sign.
Can I replace commas with line breaks, or line breaks with something else?
Yes. While "Read \n and \t as line break and tab" is ticked, \n means a line break and \t a tab in every replacement and in non-regex find text. Find ", " and replace with \n to put each item on its own line. Type \\ for a real backslash.
What does Whole word count as a word character?
Any Unicode letter, combining mark, digit or underscore. That covers accented Latin, Cyrillic, Greek, Chinese, Japanese and Korean as well as English, so "cat" will not match inside "catalog" or "café" inside "cafés".
Can a bad regular expression freeze the page?
No. The rules only run in a separate background thread (a Web Worker). If applying them takes more than 2 seconds the thread is stopped and you are told which rule was running. A pattern with a syntax error is reported with its rule number.
Is my text sent anywhere?
No. Everything happens in your browser and nothing is stored or uploaded.
Related tools
Regex Tester
JavaScript regex tester with flags, match highlighting, group table and replace preview
Remove Duplicate Lines
Delete repeated lines and keep the first of each, in order
Remove Line Breaks
Join lines and clean up spacing, with an option to keep paragraphs
Fullwidth Halfwidth Converter
Switch text between fullwidth and halfwidth characters, option by option