Search code examples
regexkrl

How to formulate this select statement in KRL?


I'm trying to write a select statement that will run on www.google.com/blahblahblah but not www.google.com/readerblahblahblah

Please help. I don't even know where to start.


Solution

  • If you want to literally match the "blahblahblah" you can do something like this:

    select when pageview "www\.google\.com/blahblahblah"
    

    This will not match "readerblahblahblah". If, however, you mean that you want to match everything on google.com except for "/reader", you'll need something like this:

    select when pageview "www\.google\.com/(?!reader)(.*)" setting (matched)
    

    See the answer here for more details.