-1

I need to create a regex query for a Google Analytics goal. The goal url must contain:

thankYou.sjs?donate_page

However, there are many urls than can render this string, all with other modifiers that I don't care about.

Please advise.

4

2 回答 2

0

Just the string itself will work. If you want only this string, just use the start/end of string zero-width assertions:

^thankYou\.sjs\?donate_path$
于 2013-02-09T22:30:39.790 回答
0

@ExplosionPills:我想你忘记了问号的特殊含义。如果你不逃避它,你的表情:

^thankYou.sjs?donate_path$

会匹配

thankYou.sjsdonate_path

或者

thankYou.sjdonate_path

更不用说点的特殊含义了。

所以我想这样的事情应该有效:

thankYou\.sjs\?donate_path

此外,如果 donate_path 可能不是查询字符串中的第一个,您可以使用它:

thankYou\.sjs\?([^&]*&)*donate_path
于 2013-02-09T23:26:44.577 回答