Notepad++:: 通过正则表达式完全删除包含问号的行 [英] Notepad++:: Completely remove lines that contains question mark via Regex
本文介绍了Notepad++:: 通过正则表达式完全删除包含问号的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗯,我想这就是我的标题,对我将要实现的目标几乎不言自明.
Well, I guess that that is my title is pretty much self explanatory on what I'm about to achieve.
这是我当前文本文件的示例:
Here is an example of my current text file:
"Diva" was the winning song of the Eurovision Song Contest 1998.
Who will win Eurovision Song Contest 2015?
Eurovision Song Contest Statistics:
Who will win Eurovision 2015?
这就是我想要的:
"Diva" was the winning song of the Eurovision Song Contest 1998.
Eurovision Song Contest Statistics:
所以基本上每一行包含 ?
字符(位置不一定在行尾)都将被替换.
So basically each line that contains the ?
character (the location doesn't necessarily have to be at the end of the line) will be replaced with nothing.
我试过 [^\r\n]*?[^\r\n]*([\r\n]+|$)
但它删除了太多.
I have tried [^\r\n]*?[^\r\n]*([\r\n]+|$)
but it removes too much.
推荐答案
^[^\n]*\?[^\n]*(?:\n|$)
试试这个.替换为空字符串
.看演示.
Try this.Replace by empty string
.See demo.
https://regex101.com/r/sJ9gM7/76
这篇关于Notepad++:: 通过正则表达式完全删除包含问号的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文