BBEdit-compatible regex for remove blank lines

Jack Cooper Smith picture Jack Cooper Smith · Aug 9, 2012 · Viewed 12k times · Source

i've tried other regexes that are supposed to be able to remove blank lines from a document, but none of them seem to work within BBEdit's find-and-replace.

What is a regex for stripping blank lines from a document that will work in bbedit?

Answer

steveax picture steveax · Aug 9, 2012

I'm going to assume that there may be whitespace in the lines you wish to remove. This should do the trick:

^\s*?\r

(replace with nothing, make sure the "Grep" checkbox is ticked)