editpad regex. Searching files for "http://" but excluding "http://particular.domain.com"

36 Views Asked by At

I'm using RegexBuddy and getting nowhere defining a search parameter for editpad.

I'm trying to search through my CMS web site for all instances of "http://" (to see where the protocol was hardcoded incorrectly), but every file has "http://particular.domain.com" in the comments near the top of the file.

How can I search for all EXCEPT those? This seems like it should be basic.

2

There are 2 best solutions below

3
p e p On BEST ANSWER

Here's your expression:

http:\/\/(?!particular\.domain\.com).+

Check out a demo here: https://regex101.com/r/eT2cX8/2

This portion is called a negative lookahead that lets you negate that match:

(?!particular\.domain\.com).+
0
R Nar On

use a negative lookahead:

'(?!http://particular.domain.com)http://'

is an example of a pattern that would match any http:// text EXCEPT the particular one