简体   繁体   中英

Regex to retrieve all URLs not containing specific string

I am using the Google Analytics PHP API, and trying to use it to retrieve the most popular links on my website.

It works, but it retrieve some duplicates due to it retrieving URLs containing query strings. So basically, I want to retrieve all the links which do not contain the string "?start=" inside them. I think this can be done via regex (Google Analytics accepts regex filters), but don't know how.

Any ideas?

Thanks!

You can use negative look ahead regex assertion.

See http://www.perlmonks.org/?node_id=518444 and http://www.regular-expressions.info/lookaround.html

your_string(?!\?start=)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM