简体   繁体   English

在记事本++中,将定义的换行符替换为符号

[英]In notepad++, replace the defined line break with a symbol

For example, I have a text like this: 例如,我有这样的文本:

驕傲淫亂嫉妒
0108
我看到你的靈魂和面容起了變化
0109
因為你心中的那只巨獸正
張牙舞爪的爬出來
0110
你看到人心潛藏的罪惡
0111
卻看不到我心中的痛苦
0112

I would like to join 2 continous lines(there's no number being between) with a "|", then replace the numbers with blanks. 我想用“ |”连接2个连续的行(中间没有数字),然后将数字替换为空格。 For the example above, the result is: 对于上面的示例,结果是:

驕傲淫亂嫉妒

我看到你的靈魂和面容起了變化

因為你心中的那只巨獸正|張牙舞爪的爬出來

你看到人心潛藏的罪惡

卻看不到我心中的痛苦

I do not have much knowledge about notepad++. 我对notepad ++不太了解。 Could anybody help me? 有人可以帮我吗? Thanks. 谢谢。

If I am understanding your problem correctly then a simple regular expression in Find & Replace will solve your problem correctly. 如果我正确地理解了您的问题,那么“查找和替换”中的简单正则表达式将正确解决您的问题。

Your Find string [0-9]+ and your Replace string should be empty 您的查找字符串[0-9]+和您的替换字符串应为empty

After above replace, search the expression (.+)\\r\\n(.+) and replace it with \\1|\\2 . 完成上述替换后,搜索表达式(.+)\\r\\n(.+)并将其替换为\\1|\\2 This will help you join the continuous lines. 这将帮助您加入实线。

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

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