CotEditor has a powerful find and replacement feature that also can use regular expressions.
In the CotEditor app
on your Mac, open a document.
Choose Find > Find.
Enter the text to find to the find field, the field with a lope icon.
To replace matched text, enter the text to replace with to the replacement field, the field with a pen icon in addition to the search text. When the replacement field is empty by replacement, the matched text is 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 and replacement text by selecting them from the lope/pen icon in the 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 | 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 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 specify 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.