In Google Analytics i have to analyze all sizes which have the first sublfolder "print". Some examples are:
在谷歌分析中,我必须分析所有具有第一个子文件夹“print”的大小。一些例子:
http://www.example.com/print/digitalprint and http://www.example.com/print/canvasprint
http://www.example.com/print/digitalprint和http://www.example.com/print/canvasprint
And so on, but the page rint itself should also be selected: http://www.example.com/print.
等等,但是页面rint本身也应该被选中:http://www.example.com/print。
Not inside the selection should be pages like http://www.example.com/web/printsolutions and so on.
选择的内部不应该是http://www.example.com/web/printsolutions等页面。
Thx for your help.
谢谢你的帮助。
1 个解决方案
#1
3
In Google Analytics, the string passed to the regex is the path part after the host, so, all you need is to make sure the string starts with /print
and then only matches the end of string or /
and anything up to the end of string.
在谷歌分析中,传递给regex的字符串是在主机之后的路径部分,所以,您所需要的就是确保字符串从/print开始,然后只匹配字符串的末尾或/和字符串末尾的任何内容。
^/print(/.*)?$
This will match the /print/digitalprint
, /print/canvasprint
, and /print
(and /print/
, too), but won't match /web/printsolutions
.
这将匹配/print/digitalprint、/print/canvasprint和/print(以及/print/也),但不匹配/web/printsolutions。
See the regex demo
看到regex演示
Details:
细节:
-
^
- start of string - ^ -字符串的开始
-
/print
- a literal char sequence/print
- /print -文字字符序列/打印
-
(/.*)?
- an optional sequence of:-
/
- a slash - / -一个斜杠
-
.*
- zero or more chars other than line break chars - 。* -除换行字符外,零字符或更多字符
-
- (/ . *)?-一个可选的序列:/ -一个斜杠。* -零或更多的字符,而不是换行字符。
-
$
- end of string - $末端的字符串。
Since /
is not used as a regex delimiter, there is no point escaping it in a GA regex pattern.
因为/不用作regex分隔符,所以在GA regex模式中没有必要转义它。
#1
3
In Google Analytics, the string passed to the regex is the path part after the host, so, all you need is to make sure the string starts with /print
and then only matches the end of string or /
and anything up to the end of string.
在谷歌分析中,传递给regex的字符串是在主机之后的路径部分,所以,您所需要的就是确保字符串从/print开始,然后只匹配字符串的末尾或/和字符串末尾的任何内容。
^/print(/.*)?$
This will match the /print/digitalprint
, /print/canvasprint
, and /print
(and /print/
, too), but won't match /web/printsolutions
.
这将匹配/print/digitalprint、/print/canvasprint和/print(以及/print/也),但不匹配/web/printsolutions。
See the regex demo
看到regex演示
Details:
细节:
-
^
- start of string - ^ -字符串的开始
-
/print
- a literal char sequence/print
- /print -文字字符序列/打印
-
(/.*)?
- an optional sequence of:-
/
- a slash - / -一个斜杠
-
.*
- zero or more chars other than line break chars - 。* -除换行字符外,零字符或更多字符
-
- (/ . *)?-一个可选的序列:/ -一个斜杠。* -零或更多的字符,而不是换行字符。
-
$
- end of string - $末端的字符串。
Since /
is not used as a regex delimiter, there is no point escaping it in a GA regex pattern.
因为/不用作regex分隔符,所以在GA regex模式中没有必要转义它。