问题描述
我使用Google Analytics(分析)PHP API,并尝试使用它来检索我网站上最受欢迎的链接。
它可以工作,但它会检索一些重复项由于它检索包含查询字符串的URL。所以基本上,我想检索所有不包含字符串?start =的链接。我认为这可以通过正则表达式来完成(谷歌分析接受正则表达式过滤器),但不知道如何。
有什么想法?
谢谢!
您可以使用负面展望正则表达式断言。
请参阅和
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=)
这篇关于正则表达式来检索所有不包含特定字符串的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!