# 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.

- Click the Add button + at the bottom of the list to create a new replacement definition.
- Click the Remove button - at the bottom of the list to delete the replacement definition that is selected in the list.
- Click again the selected definition in the list to rename it.
- Click the Advanced button with a gear symbol for further operations.

### 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.

- Export: Select a definition to export in the list on the left, then choose Export or Share in the Advanced menu at the bottom of the list.
- Import: Drop replacement definition files to the list on the left. Alternatively, choose Import in the Advanced menu, then select the replacement definition files to import.

## 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.

- Replace All: Perform the replacement for the frontmost document.
- Highlight: Highlight all matches in the frontmost document*.

* 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

Option | Description
--- | ---
(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.
Find | A string to search for. You cannot leave this field blank. When it is blank, the row is ignored as it is invalid.
Replace With | A string to replace with. If you leave this field, the matches are just deleted.
RE | Search with regular expression (abbreviation of Regular Expression).
IC | Ignore character case on search (abbreviation of Ignore Case).
Description | You 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

- Find or replace text
- Use the regular expression