更新时间:2023-02-17 23:14:18
您可以使用负面展望正则表达式断言。
请参阅 http://www.perlmonks.org/?node_id=518444和 http://www.regular-expressions.info/lookaround.html
your_string(?!\?start =)
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=)