简体   繁体   English

使用某些标签在Notepad ++中合并正则表达式行

[英]Merge lines with regex in Notepad++ with certain tags

I would like to know how I can merge lines within Notepad++ using regex , with certain tags that start with the character. 我想知道如何使用regex与某些以字符开头的标签合并在Notepad ++中的行。 For example: 例如:

1|AAA
BBB
CCC
6|DDD
1|EEE
FFF
6|GGG
1|HHH
UUU
III
6|OOO

The expected result: 预期结果:

1|AAABBBCCC6|DDD
1|EEEFFF6|GGG
1|HHHUUUIII6|OOO

The new records start with 1| 新记录以1 |开头 line and end with 6| 行并以6 |结尾 line. 线。 Thanks 谢谢

\r\n(?=(?:(?!1\|)[\s\S])*?6\|)

You can this and replace by empty string .See demo. 您可以这样做,并用empty string替换。请参见演示。

https://regex101.com/r/vP2zF2/3 https://regex101.com/r/vP2zF2/3

You could just use this: 您可以使用以下代码:

\s(?=[^1])

Regex Demo Here 正则表达式演示在这里


Also tested in Notepad++ 也在Notepad ++中测试

在此处输入图片说明

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

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