Replace text by multiple rules in CotEditor on Mac

Using the Multiple Replacement feature, you can process multiple text replacements at once in succession. The replacement rules can be stored as a named preset and reused when you need.

Use Multiple Replace window

You can open the Multiple Replace window to manage and process the multiple replacements in your document.

  1. Choose Find > Multiple Replace.

Manage replacement definitions

The stored replacement definitions that you created before are listed in the list on the left.

Export/import replacement definitions

You can export your replacement definitions to transfer them to another computer. Each replacement definition becomes a single CotEditor replacement definition file, which has .cotrpl file extension and of which contents are written in the JSON format.

Process multiple replacements

The definition selected in the list on the left is shown in the editor area on the right side. The replacement rules in the editor area are performed row by row from top to bottom at once.

Use the buttons at the bottom of the editor area to perform multiple replacements.

* Beware that the matches by the Highlight command can be different from the replacement targets when you perform actual Replace All, because, on the Replace All, the succeeding rows are applied to the document that the previous rows above have already been applied to.

Edit replacement definition

You can create your own replacement definitions to process multiple replacements.

Create a new replacement definition

  1. Click the Add button + at the bottom of the list on the left side to create a new replacement definition.
  2. Click the Add button + in the editor area on the right side to create a new replacement rule.
  3. Input your desired replacement rule to the added row.

You don’t need to perform a save after the modification because your changes are saved automatically and immediately during editing.

A row with an invalid replacement rule is just skipped when the replacement is performed.

Replacement rule options

OptionDescription
(checkbox)If the checkbox is unselected, the row is not applied and just skipped. You can use this option to keep a replacement rule that is used depending on the situation.
FindA string to search for. You cannot leave this field blank. When it is blank, the row is ignored as it is invalid.
Replace WithA string to replace with. If you leave this field, the matches are just deleted.
RESearch with regular expression (abbreviation of Regular Expression).
ICIgnore character case on search (abbreviation of Ignore Case).
DescriptionYou can use this field to leave a comment about the rule. The description doesn’t affect to replacement. This field can be left blank.

Advanced find options

You can customize the delicate find behavior of replacement from the advanced options view. Those settings are also saved to your replacement definition and applied to all rules in the same replacement definition. Click the gear button in the Multiple Replace window, then click checkboxes to change the behavior.

To learn about details of each option item, see Find or replace text.

See also