1

I want to match a URL containing both "foo" and "bar" but not "bar=0".

I'm trying to do this in Google Analytics and it doesn't support lookahead expressions.

So I am matching urls containing both "foo" and "bar" with this expression (foo.+bar) but how do I negate urls with "bar=0"?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dan
  • 29,100
  • 43
  • 148
  • 207

2 Answers2

2

You can use this regex:

\bfoo\b.+\bbar\b(?:$|=[^0]|[^=])

Live Demo: http://www.rubular.com/r/marUIfFzAz

anubhava
  • 761,203
  • 64
  • 569
  • 643
0
foo.+bar[^\=]

for this to make any sense, please post a example of a url you are trying to validate

Sedecimdies
  • 152
  • 1
  • 10