换行正则表达式在 Geany 中不起作用

Line feed regular expression doesn't work in Geany

我想在 Ubuntu 中使用 Geany 检测换行。我使用了 \n\r\r\n 等正则表达式,但它没有检测到任何东西。

有一些行尾设置我也尝试更改以使其工作,但仍然没有成功:

最后,我也尝试使用文档→设置编码菜单中的不同编码,但仍然没有成功。

我想我做错了什么,但我仍然不知道是什么。

作为Mohammad Yusuf Ghazi , you need to enable the Use multi-line matching option. See the Geany docs:

The Use multi-line matching dialog option enables multi-line regular expressions.

Multi-line regular expressions work just like single-line ones but a match can span several lines.

此外,您还可以使用\R shorthand class for any line break sequence:

Newline sequences

Outside a character class, the escape sequence \R matches any Unicode newline sequence. This particular group matches either the two-character sequence CR followed by LF, or one of the single characters LF (linefeed, U+000A), VT (vertical tab, U+000B), FF (formfeed, U+000C), CR (carriage return, U+000D), NEL (next line, U+0085), LS (line separator, U+2028), or PS (paragraph separator, U+2029). The two-character sequence is treated as a single unit that cannot be split. Inside a character class, \R matches the letter "R".

在打开文件内的简单搜索中,select 从行尾到第一行开头。复制并粘贴到查找框中。

它会被看作是一个方框,里面写着四个字母。这肯定会检测到Geany中的每个LF。

在正则表达式中,使用 $ 而不是 \r\n\R。它会在Geany中以多行模式检测行尾。