RegEx function for exception using Notepad ++

Possible duplicate:
notepad ++ Reverse Regex replace (everything except string)

Say I have the following ...

http://whateverurl.com/is-not-wanted-but-it-is-here-anyway http://icantbelieveibeenonthisallday.com/i-want-to-shoot-myself http://hereiswhatireallywant.net/hey-there-sweet-thang http://howsithangingloser.org/i-hope-someone-helps-you http://heresanotherbeauty.net/that-i-want-to-be-all-up-in 

I want to find only lines that DO NOT contain ".net /", so I can replace it with nothing, so I will delete it.

I searched online and this site and found the string (?! Xxx) , so I tried to make (?!. Net /) but it seems that Notepad ++ does not support this string or I may use it incorrectly since I'm new to RegEx .

Can someone tell me how to find a string that excludes a specific character string in Notepad ++?

+4
source share
1 answer

As far as I can tell, Notepad ++ regex support does not allow you to capture a newline character. You better use this regex:

 ^.*\.net.*$ 

Replace it with nothing (now it's an empty string), then change the search mode to advanced and replace \r\n\r\n with \r\n (or \n\n by \n if you use a Unix-style line ending). strike>

BoltClock noted that I am lagging behind in time, and this version 6 supports it. You can use this regex to find these lines and remove them:

 ^.*\.net.*(\r\n|$) 

EDIT

I appreciate your answer, but you misunderstood what I said. I am trying to find lines that DO NOT CONTAIN .net / to remove them. It can be done?

Oops If you want to match strings that don't have .net , use this expression:

 ^(?!.*?\.net/).*\r\n 

Works in Notepad ++ 6.

+8
source

Source: https://habr.com/ru/post/1413855/


All Articles