Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex Data Studio排除URL参数_Regex_Google Data Studio_Re2 - Fatal编程技术网

Regex Data Studio排除URL参数

Regex Data Studio排除URL参数,regex,google-data-studio,re2,Regex,Google Data Studio,Re2,我已经设法在Google Data Studio上使用一个正则表达式来创建一个“last path”目录值,它非常有效,使用 REGEXP_EXTRACT( Page , '.*/(.*)/' ) 是否可以排除带有参数的URL 例如,正则表达式与 /目录1/ /目录1/?变量=1 /目录1/?变量=2 因此,我希望排除任何?var=URL,但不限于var参数值 感谢您的帮助。要解决当前问题,请使用 REGEXP\u摘录(第页,.*/(.*)/$) 锚定$停止匹配/之后有更多文本的内容。如果存

我已经设法在Google Data Studio上使用一个正则表达式来创建一个“last path”目录值,它非常有效,使用

REGEXP_EXTRACT( Page , '.*/(.*)/' )
是否可以排除带有参数的URL

例如,正则表达式与

/目录1/

/目录1/?变量=1

/目录1/?变量=2

因此,我希望排除任何?var=URL,但不限于var参数值


感谢您的帮助。

要解决当前问题,请使用

REGEXP\u摘录(第页,.*/(.*)/$)
锚定
$
停止匹配
/
之后有更多文本的内容。如果存在查询字符串,则不会发生匹配

解释

--------------------------------------------------------------------------------
  .*                       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

要解决当前问题,请使用

REGEXP\u摘录(第页,.*/(.*)/$)
锚定
$
停止匹配
/
之后有更多文本的内容。如果存在查询字符串,则不会发生匹配

解释

--------------------------------------------------------------------------------
  .*                       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

REGEXP\u EXTRACT(第页,.*/(.*)/$)
?感谢您的回复,但它返回null,因此不起作用…我认为您的思路正确,但每年都没有匹配项?包括在stringSee中,以确保其正常工作。它不会吞噬问号。你是对的,谢谢,一些最热门的流量结果被取消了,但更进一步,它收集了正确的结果。谢谢大家!
REGEXP_EXTRACT(第页,.*/(.*)/$)
?感谢您的回复,但它返回null,因此不起作用…我认为您的思路正确,但每年都没有匹配项?包括在stringSee中,以确保其正常工作。它不会吞噬问号。你是对的,谢谢,一些最热门的流量结果被取消了,但更进一步,它收集了正确的结果。非常感谢。