Google Analytics正则表达式

时间:2012-09-27 14:19:40

标签: regex google-analytics

有点Rgeluar表达的新手,为了学习的好处,想知道如何在一行中做到以下几点:

页面匹配正则表达式:.pdf / $

和包含“somestring”的页面

和页面不包括“someotherstring”

我可以使用上面的3条规则获得我想要的输出。我的问题是我可以使用正则表达式将所有内容放入一行吗?所以第一行就是:

page matching reg exp: .pdf/$ somestring+ (then regex for does not contain in GA) someotherstring

是否有可能把所有人都放在一个人身上?

1 个答案:

答案 0 :(得分:1)

Lookahead将帮助您在一个表达式中匹配多个独立的事物,甚至允许要求不匹配。在你的情况下:

/^(?=.*somestring)(?!.*someotherstring).*\.pdf$/