Text Replacer

Apply a list of find and replace rules to a block of text in one pass.

Text
Rules, one per line: find => replace
Result
Runs locally in your browser

About the Text Replacer

Most replace tools give you one pair of boxes, which means running the same job five times for five substitutions. Here the second pane holds a rule list: one rule per line, written as the text to find, an arrow made of an equals sign and a greater-than sign, then the replacement. Rules are applied top to bottom, so a later rule sees the output of the earlier ones, and a line beginning with # is a comment you can use to label groups or park a rule you are not ready to run.

Three matching styles share the same list. Plain text treats your search literally, so punctuation and brackets need no escaping. Whole words only adds word boundaries, which stops cat from rewriting the middle of concatenate. Regular expression mode passes the search half to the engine unchanged and lets the replacement half reference capture groups with $1, $2 and so on, so (\w+), (\w+) => $2 $1 flips a surname and forename column.

The replacement may contain \n or \t to insert a newline or tab, which is how you split one line into several. A rule without the arrow, an empty search, or a regular expression that will not compile stops the run with a message naming the offending rule instead of half-applying the list. The status counts total replacements. For a single one-off substitution, Find and Replace is quicker, and Regex Tester helps you build a pattern before you paste it here.

How to use

  1. Paste your text in the first pane.
  2. Write one rule per line in the second pane as find => replace.
  3. Choose Plain text, Whole words only or Regular expression.
  4. Copy the result; the status shows how many replacements were made.

Common questions

How do I write a rule?
Put the search text, then =>, then the replacement, all on one line. For example: staging => production.
What if my search text contains =>?
Only the first arrow on the line splits the rule, so an arrow later in the search half is treated as ordinary text.
Can a rule delete text?
Yes. Leave the right side of the arrow empty and every match is removed.
In what order do the rules run?
Top to bottom, each over the whole text. Put broader rules last so they do not undo the specific ones above them.