CotEditor has a powerful find and replacement feature that also can use regular expression.
To show the Find window, select the Find command in the Find menu.
Enter the text to find to the find field, the field with a lope icon; and enter the text to replace with to the replacement field, the field with a pen icon. When the replacement field is empty by replacement, the matched texts are just removed.
To insert the following special characters to the fields, use the following key combinations:
| Character | Key combination |
|---|---|
| line ending character | Option-Return |
| tab character | Option-Tab |
You can reuse previous find/replacement strings by selecting them from the lope/pen icon in the field.
| Option | Description |
|---|---|
| Regular Expression | Search with regular expression. |
| Ignore Case | Ignore character case on search. |
| In Selection | Search text only from selection. |
You can customize the find behavior in the advanced find options view. To open the view, click the gear button in the Find window.
| Option | Description |
|---|---|
| Wrap search around | Find from the the beginning of the document if there is no match after the insertion point. |
| Search incrementally | Search document as you type in the search field. |
Options for search when the regular expression is turned off.
| Option | Description | Default |
|---|---|---|
| Match only whole word | Restrict search results to the whole words. | Off |
| Distinguish characters strictly | Exact character-by-character equivalence. | Off |
| Ignore diacritical marks | Search ignores diacritical marks (e.g., ö = o). | Off |
| Ignore width differences | Search ignores width differences in character forms (e.g., a = a). | Off |
Options for search when the regular expression is selected.
| Option | Description | Default |
|---|---|---|
| Dot matches line separators | Allow . to match any character, including newline characters (singleline). | Off |
| Anchors match lines | Allow ^ and $ to match the start and end of lines (multiline). | On |
| Use Unicode word boundaries | Use Unicode TR#29 to specify word boundaries | Off |
| Unescape replacement string | Unescape meta characters with backslash in replacement string. | On |