Sometimes, copy pasting code from my email makes everything have an extra blank line.
For example
1: hi
2:
3: hello
4:
Is there a way to target these empty lines with regex and delete them? I'm using notepad++ with the search(with regex) and replace capability.
Because Notepad++ regex operates only line by line, without a multi-line mode, you can't remove entire lines with regex alone. This is no longer true as of Notepad++ 6.0, which now uses PCRE as its regex engine and allows for multi-line replacements. See this answer for more info.
The TextFX plugin that Notepad++ ships with allows you to remove blank lines without using regex. Just highlight your entire document (Ctrl+A) and do TextFX > TextFX Edit > Delete Blank Lines. If your selection or document begins and/or ends with a blank line though, those lines won't be removed automatically — but removing those is just a matter of:
Ctrl+Home
Del
Ctrl+End
Backspace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With