0

I need to search through a number of files, to search for lines that end with a LF (\n) only as opposed to a CRLF (\r\n).

How can I perform a search for only the LF and not pick up all the CRLF characters. By performing a search for '\n', it will pick up both.

I am looking to find: \n

while ignoring: \r\n

GUVI
  • 3
  • 1

2 Answers2

1

Combining this answer and this answer, we get:

(?!\r)\n

You need to select Regular expression, not the Extended radio button. According to the documentation:

(?!assert) (negative lookahead)

The (?!\r) means that we do not include the not-\r in our match, whereas [^\r]\n would match the last character on the previous line along with the \n.

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
1

You can use the regexp search and give the regexp as [^\r]\n which will ignore \r and match \n