Search code examples
regexeditpad

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


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.


Solution

  • 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).+