正则表达式与通配符匹配到行尾

时间:2022-01-29 14:57:10

I need to match a URL in google analytics for use in a goal and a funnel.

我需要匹配Google Analytics中的网址,以便在目标和渠道中使用。

I would like to match a url for http://url.com/guides/anything-that-comes-after

我想匹配http://url.com/guides/anything-that-c​​omes-after的网址

I will be matching /guides on it's own goal, but would like to match /guides/* (how I would do it with a simple wildcard) with the regex.

我将匹配/指导它自己的目标,但想与正则表达式匹配/指南/ *(我将如何使用简单的通配符)。

2 个解决方案

#1


5  

So you're trying to match anything that comes after "guides/", basically?

所以你试图匹配“指南/”之后的任何东西,基本上?

^http\:\/\/url\.com\/guides\/(.+)$

should match anything after your based URL. If you want to make it domain independent, try this:

应匹配基于您的网址后的任何内容。如果您想使其独立于域,请尝试以下操作:

^http\:\/\/.+?\/guides\/(.+)$

#2


0  

Try the following:

请尝试以下方法:

.*?/guides/(.*)

#1


5  

So you're trying to match anything that comes after "guides/", basically?

所以你试图匹配“指南/”之后的任何东西,基本上?

^http\:\/\/url\.com\/guides\/(.+)$

should match anything after your based URL. If you want to make it domain independent, try this:

应匹配基于您的网址后的任何内容。如果您想使其独立于域,请尝试以下操作:

^http\:\/\/.+?\/guides\/(.+)$

#2


0  

Try the following:

请尝试以下方法:

.*?/guides/(.*)