问题描述
我试图在Google Analytics中使用正则表达式设置目标,以匹配应包含字符串_thanks但不应包含-cl-或-wf-或 - 的网址的网址。 WL-。
如果Google Analytics支持负面预测,这样做会更容易,但不幸的是它不会。
例如,目标应该匹配:
/ba-ck-wp-example-of-a-page_thanks.html?ad = 1073
/ba-default-page_thanks.html
/ba-nt-visit-some-page_thanks.html?ad=1731
但不应该匹配:
/ ba-cl-a- free-quote_thanks.html
/ba-wf-information-report_thanks.html
/ba-wl-information-otherreport-example_thanks.html
任何帮助都将不胜感激。
^(:[^ - ] | - (?:??[^ CW] | C [^ 1] | W [^ a]并) - | - {2} [^ - ])* _thanks
正如您所看到的,复杂性随着您不想要的单词的长度而增加匹配(在这种情况下,4个字符)增长。
I'm trying to set up a Goal in Google Analytics using regular expressions to match urls that should contain the string "_thanks" but should not match urls that contain "-cl-" or "-wf-" or "-wl-".
This would be easier to do if Google Analytics would support negative lookahead, but unfortunately it doesn't.
For example the Goal should match:
/ba-ck-wp-example-of-a-page_thanks.html?ad=1073
/ba-default-page_thanks.html
/ba-nt-visit-some-page_thanks.html?ad=1731
But shouldn't match:
/ba-cl-a-free-quote_thanks.html
/ba-wf-information-report_thanks.html
/ba-wl-information-otherreport-example_thanks.html
Any help would be much appreciated.
^(?:[^-]|-(?:[^cw].?|c[^l]|w[^fl])-|-.{2}[^-])*_thanks
As you can see, the complexity increases as the length of the words you don't want to match (in this case 4 characters) grows.
这篇关于Google Analytics正则表达式包含并排除了没有负面预测的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!