Regex match a word not followed by two other words

前端 未结 1 1887
暗喜
暗喜 2021-01-26 10:57

I have some links:

utmcsr=rdstation|utmccn=curso-intro-coaching|utmcmd=inbound|utmctr=link3
utmcsr=rdstation|utmccn=agenda-psc|utmcmd=email
utmcsr=rdstation|utmc         


        
相关标签:
1条回答
  • 2021-01-26 11:25

    The problem is that your negative lookahead is anchored to the position directly after rdstation. It would only exclude strings like this:

    rdstationemail asdf 123 4
    

    You need to make sure it can match anywhere after rdstation:

    rdstation(?!.*(email|inbound))
    

    Working example here.

    0 讨论(0)
提交回复
热议问题