简体   繁体   中英

Collapse multiple empty lines in content to a single line in Notepad++

Is there a way in Notepad++ to collapse multiple empty lines in content to a single line?

For example, from this:

Line0
Line1


Line2



Line3

Line4
Line5

to this:

Line0
Line1

Line2

Line3

Line4
Line5

I would like to run a replacement on a folder with "Find In Files" function; is there a way to be able to do it?

[\r\n]{2,}

You can replace by \\n or \\n\\n .See demo.

https://regex101.com/r/tD0dU9/12

EDIT:

use (?:\\r\\n){2,} for notepadd ++

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM