简体   繁体   English

在记事本中将内容中的多个空行折叠为一行

[英]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? Notepad ++中是否可以将内容中的多个空行折叠为一行?

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. 您可以用\\n\\n\\n代替。请参见演示。

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

EDIT: 编辑:

use (?:\\r\\n){2,} for notepadd ++ (?:\\r\\n){2,}用于记事本++

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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