Find or replace text in CotEditor on Mac

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.

Find/Replacement Fields

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:

CharacterKey combination
line ending characterOption-Return
tab characterOption-Tab

Find/Replacement Histories

You can reuse previous find/replacement strings by selecting them from the lope/pen icon in the field.

Find Options

OptionDescription
Regular ExpressionSearch with regular expression.
Ignore CaseIgnore character case on search.
In SelectionSearch text only from selection.

Advanced Find Options

You can customize the find behavior in the advanced find options view. To open the view, click the gear button in the Find window.

OptionDescription
Wrap search aroundFind from the the beginning of the document if there is no match after the insertion point.
Search incrementallySearch document as you type in the search field.

Textual Search

Options for search when the regular expression is turned off.

OptionDescriptionDefault
Match only whole wordRestrict search results to the whole words.Off
Distinguish characters strictlyExact character-by-character equivalence.Off
Ignore diacritical marksSearch ignores diacritical marks (e.g., ö = o).Off
Ignore width differencesSearch ignores width differences in character forms (e.g., a = a).Off

Regular Expression Search

Options for search when the regular expression is selected.

OptionDescriptionDefault
Dot matches line separatorsAllow . to match any character, including newline characters (singleline).Off
Anchors match linesAllow ^ and $ to match the start and end of lines (multiline).On
Use Unicode word boundariesUse Unicode TR#29 to specify word boundariesOff
Unescape replacement stringUnescape meta characters with backslash in replacement string.On

See also