4

I want to detect line feed with Geany in Ubuntu. I used regular expressions such as \n , \r and \r\n, but it doesn't detect anything.

Enter image description here

Enter image description here

There are some line ending settings that I also try to change to make it work, but still no success:

Enter image description here

And finally, I also tried to use different encoding from document → set encoding menu, but still no success.

I guess I am doing something wrong, but I still don't know what.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sadegh
  • 865
  • 1
  • 23
  • 47

2 Answers2

7

As Mohammad Yusuf Ghazi comments, 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.

Besides, you may also use \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".

Community
  • 1
  • 1
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
0

In a simple search just within the open file, select from the end of the line to the beginning of the first line. Copy and paste in the find box.

It will be seen as a squarebox with four letters written inside. This will definitely detect each LF in Geany.

In regex, use $ instead of \r\n or \R. It will detect the end of line in multiline mode in Geany.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
knjhaveri
  • 121
  • 4