CotEditor provides powerful find and replace features, including regular expression search.
In the CotEditor app
on your Mac, open a document.
Choose Find > Find.
Enter the text to search for in the field with the magnifying glass icon.
To replace matched text, enter replacement text in the field with the pen icon. If the replacement field is left empty, the matched text is removed.
To insert the following special characters in these fields, use these key combinations:
| Character | Key combination |
|---|---|
| line ending character | Option-Return |
| tab character | Option-Tab |
You can reuse previous search and replacement text by selecting it from the magnifying glass or pen icon in each field.
| Option | Description |
|---|---|
| Regular Expression | Search with regular expressions. |
| 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 button in the Find window.
| Option | Description |
|---|---|
| Wrap search around | Continue searching from the beginning of the document if there is no match after the insertion point. |
| Search incrementally | Search the document as you type in the search field. |
Options for search when the regular expression option is turned off.
| Option | Description | Default |
|---|---|---|
| Match only whole words | Restrict search results to whole words. |
Off |
| Distinguish characters strictly | Exact character-by-character equivalence. |
Off |
| Ignore diacritical marks | Search ignores diacritical marks (for example, ö = o). |
Off |
| Ignore width differences | Search ignores width differences in character forms (for example, a = a). |
Off |
Options for search when the regular expression is selected.
| Option | Description | Default |
|---|---|---|
| Dot matches line separators | Allow period 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 determine word boundaries. |
Off |
| Unescape replacement text | Unescape metacharacters with backslash in the replacement text. |
On |
With the Find All and Highlight All commands, all the places in the document that match your search criteria can be highlighted. When searching using regular expressions, each captured group is highlighted in a different color.
To remove the highlight, choose Find > Remove Highlights.