Typing Option-Return in a input field in the Find window breaks a line.
On the normal textual search, the line endings contained in the search string are assumed to be the line ending code used in the document being searched for. That is, it doesn’t match the line endings that differ from the document line ending type.
As with the textual search, the line endings contained in the search string are assumed to be the line ending code used in the document being searched for. On the other hand, the line endings specified as a metacharacter or a Unicode code point in the regular expression pattern are treated as-is regardless of the line endings type of the target document.
| Pattern | Description |
|---|---|
| \n | U+000A, the line ending character for LF |
| \r | U+000D, the line ending character for CR |
| \r\n | The sequence of U+000D and U+000A, the line ending character for CRLF |
| \R | Any kind of line endings from U+000A (LF), U+000B, U+000C, U+000D (CR), U+0085, U+2028, U+2029, or the sequence of U+000D U+000A (CRLF). |
As for the text replacing with, all line endings, even ones defined as a metacharacter like\n or captured, are assumed to be the document line ending.
For example, when replacing the find string “dog\Rcow” with the replacement string “$0\r” using the regular expression in a document whose line ending type is LF (\n), the substring “dog\r\ncow” in the document matches as well, and theoretically, the regular expression should replace it with “dog\r\ncow\r”; however CotEditor actually replaces it with “dog\ncow\n”.
There is currently no way to replace them with line endings other than the document line ending.