我一直在与这个圈子圈出来。
我想在Google Analytics(分析)中执行一个内容分组,该分析系统通过3级子目录进行了分组。
我可以使用以下正则
成功抓住第二级`/destinations/(.*?)/`
url是
mydomain.com/destinations/europe
mydomain.com/destinations/alaska
我获得了欧洲和阿拉斯加的内容组。
但是,我也想要一个下一个级别的分组,例如
mydomain.com/destinations/europe/southampton
mydomain.com/destinations/europe/portugal
mydomain.com/destinations/alaska/somealaskanplace
给我南安普敦,葡萄牙和Somealaskanplace的分组这意味着我需要有效地忽略第二层的一切,这就是我正在努力的。
到目前为止我有
`/destinations/.*/(.*?)/$`
但这是我作为分组的域名
有人可以帮忙吗?将不胜感激。
您需要在
上拥有多行旗检查以下内容:
/.*?/(destinations)/(w+)/(w+)/gm
REGEX101上的演示:https://regex101.com/r/2wvrix/2
我认为您不需要/
定界符。GA可能正在将您的最后一个/$
解释为斜线,然后将其解释为串线。尝试使其仅/destinations/.*/(.*?)$
(请注意,GA Regex不需要您逃脱斜线)。