How to use the find and replace rule table
- Paste or type the text you want to change.
- Write your rules, one per line, in the form find => replacement. Leave the replacement empty to delete. Use \n for a new line and \t for a tab. Lines that start with # are notes.
- Choose whether rules apply one after another or all at once, and whether to match capital letters or whole words only.
- Read the result and the count for each rule, then copy it or download it.
A form letter and a swap
In the starting example the rules {name} => Ana, {order} => #1001, {date} => March 9 and Thanks for => Thank you for turn a template into a finished message, and the notes list one replacement for each rule. Applied to "Dear {name}, Thanks for {order}", the first three rules give "Dear Ana, Thank you for #1001".
Order matters. With the two rules a => b and b => a, one after another turns "abab" into "aaaa", because the second rule also changes the b's made by the first. All at once turns it into "baba", because both rules look only at the original text. All at once is the right choice for swaps.
One after another or all at once
One after another runs the rules from the top, each on the result of the one before, which lets a later rule clean up after an earlier one. All at once reads the original text once from left to right. At each position the first rule in your list that fits is used, and the replaced text is never searched again. When two rules could start at the same place, put the longer one first, so "The cat" => "A dog" comes before "cat" => "bird".
Whole words only checks that the match is not glued to other letters or digits, so "cat" no longer matches inside "concatenate" or "category". It ignores edges that are not letters, so a rule such as "#1" still works.
Plain text only, on purpose
The rules match plain text and not patterns, so special characters like dots, stars and brackets mean themselves. That also means no rule can hang your browser with a runaway pattern. If you need patterns, a code editor is the better tool. For simple line operations, use the Text Line Tools, for changing case the Case Converter, for filling templates from a table the Mail Merge Text Generator, and for repeating text the Text Repeater.
Assumptions and limits
- Up to 200 rules and 2,000,000 characters of text are accepted. Everything runs in your browser.
- Capital letters are ignored unless you ask to match them. Whole words means letters, digits and the underscore.
- The first => in a line splits it, so a replacement may contain => itself.
- Spaces at the start and end of a find text are trimmed. A single leading space after => is dropped from the replacement.
Frequently asked questions
How do I delete text?
Leave the replacement empty, such as draft =>. Every match is removed and counted.
How do I replace a new line?
Write \n in the find text for a line break or in the replacement to add one. Write \t for a tab and \\ for a backslash.
Why did a rule change nothing?
Check the counts under the result. A rule with zero often has a capital letter mismatch, or whole word matching is on and the text is joined to other letters. Rules also cannot see text that an earlier rule removed.
Can I use regular expressions?
No. The rules are plain text only, to keep the tool fast and predictable. Special characters such as the dot and the star are matched as themselves.