Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++:: Completely remove lines that contains question mark via Regex

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?

This is what I want to get:

"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.

I have tried [^\r\n]*?[^\r\n]*([\r\n]+|$) but it removes too much.

like image 806
Hezi-Gangina Avatar asked Jan 09 '23 14:01

Hezi-Gangina


1 Answers

^[^\n]*\?[^\n]*(?:\n|$)

Try this.Replace by empty string.See demo.

https://regex101.com/r/sJ9gM7/76

like image 143
vks Avatar answered Jan 26 '23 01:01

vks