This will work using Notepad ++ (tested with version 6.2.3):
\A[\r\n]+
Explanation:
\A and \Z always match the beginning and end of the entire file, regardless of multi-line settings.
Note. This regex is somewhat more general than requested by the OP. It will remove any number of consecutive source blank lines terminated with any line break sequence ( \r\n , \r or \n ). Nothing is worse than changing thousands of files, only to find later that the pair has a different sequence of line breaks or has several original empty lines.
Alternative:
Another regex that works:
(?<!.)[\r\n]+
Explanation:
In this case, a negative look-behind, (?<!) to make sure that the character does not exist before the sequence CR and LF s.
Note. For this to work, check the box . matches newline . matches newline .
source share