Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Take for example the following:

This text file has many


double linebreaks, What is the expression


too find  these?
share|improve this question
1  
Do you want to find double linebreaks only or atleast double? – amiregelz Dec 12 '12 at 9:37
up vote 5 down vote accepted

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
share|improve this answer

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.

share|improve this answer

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

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .