5

Take for example the following:

This text file has many


double linebreaks, What is the expression


too find  these?
Gabriel
  • 2,860
  • 11
  • 36
  • 51

3 Answers3

10

If you use "regular expression" search mode:

(\r\n\s*$){2,}

Will find all instances of 2 or more blank lines, including ones that just have spaces on the line.

E.G. using a replace of \r\n

something



something else



another thing

Another








Another thing

Becomes

something

something else

another thing

Another

Another thing
Tim Radcliffe
  • 747
  • 4
  • 17
  • I ran into this issue using FTP for an old server. This option didn't work for me. I also did not want to remove more than the doubled linebreaks. This worked well for me instead: `(\r\n|\r|\n){2}`. Replaced with `\r\n`, all is well. – Radley Sustaire Oct 03 '16 at 17:32
2

Press Ctrl+F, select extended search mode and search for \r\n\r\n.

Indrek
  • 24,204
  • 14
  • 90
  • 93
SparedWhisle
  • 4,025
  • 1
  • 20
  • 30
1

To find double or more linebreaks (and ignore single linebreaks), search in Extended Mode for the following expression:

\r\n\r\n\r\n

It will match this case:

line a


line b

but not this one:

line a

line b

If you want to search and replace, you need to modify the expression a little bit.

amiregelz
  • 8,099
  • 12
  • 48
  • 58