简体   繁体   English

Notepad ++:将多个换行符减少为单个换行符

[英]Notepad++: Reducing multiple line breaks to single

My text document has multiple line breaks at random places. 我的文本文档在随机位置有多个换行符。 Want to use Notepad++ to reduce any multiple line breaks to a single line break. 想要使用Notepad ++将多个换行符减少到一个换行符。 How can I accomplish that? 我怎么能做到这一点?

I am on the lines of using \\n in extended Find/replace mode but can't quite get it. 我在扩展的查找/替换模式中使用\\n但是无法完全获得它。

You can use a regular expression S&R: 您可以使用正则表达式S&R:

(?:\r\n){2,}

or 要么

\R{2,}

in the Find what field and 查找什么字段和

\r\n

in the Replace with field. 替换为字段中。 You may adjust the replacement pattern as per your needs. 您可以根据需要调整更换模式。

在此输入图像描述

You could use \\R if you want to deal with any kind of line break (ie. \\r or \\n or \\r\\n ): 如果你想处理任何类型的换行符(即。 \\r\\n\\r\\n ),你可以使用\\R

Find what: (\\R)+ 找到: (\\R)+
Replace with: $1 替换为: $1

This will replace multiple line breaks (of any kind) with a single one. 这将用一个替换多个换行符(任何类型)。

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

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