Regex Data Studio排除URL参数



我已经成功地在Google Data Studio上使用Regex创建了一个"最后路径"目录值,该值非常有效,使用;

REGEXP_EXTRACT( Page , '.*/(.*)/' )

是否可以使用参数排除URL?

例如,regex与匹配;

/董事1/

/董事1/?var=1

/董事1/?var=2

所以我想排除任何?var=URL,但不限于var参数值。

感谢您的帮助。

要解决当前问题,请使用

REGEXP_EXTRACT( Page , '.*/(.*)/$' )

锚CCD_ 1停止匹配在CCD_ 2之后具有更多文本的任何内容。如果存在查询字符串,则不会发生匹配。

解释

--------------------------------------------------------------------------------
.*                       any character except n (0 or more times
(matching the most amount possible))
--------------------------------------------------------------------------------
/                        '/'
--------------------------------------------------------------------------------
(                        group and capture to 1:
--------------------------------------------------------------------------------
.*                       any character except n (0 or more times
(matching the most amount possible))
--------------------------------------------------------------------------------
)                        end of 1
--------------------------------------------------------------------------------
/                        '/'
--------------------------------------------------------------------------------
$                        before an optional n, and the end of the
string

最新更新