使用REGEXP_REPLACE从Google Data Studio中的URL剥离查询 [英] Strip Queries from URLS in Google Data Studio with REGEXP_REPLACE

查看:74
本文介绍了使用REGEXP_REPLACE从Google Data Studio中的URL剥离查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Google Data Studio中构建一个新的计算字段,以摆脱所有查询.我已经尝试过以下公式:

I'm trying to build a new calculated field in Google Data Studio to get rid of all the queries. I've tried the following formula :

REGEXP_REPLACE(page,"\?(.*)","")

但是Data Studio向我返回了一个无效的公式...我想那是因为它不是Google RE2 ...如何将其转换为Google RE2?

But Data Studio return me an invalid formula... I guess that's because It's not Google RE2... how do I translate this into Google RE2 ?

谢谢!

推荐答案

您可以使用

REGEXP_REPLACE(page,"[?].*","")

该模式将被解析为文字?,后跟任意0+个字符,整个匹配项将被替换为空字符串.

The pattern will be parsed as a literal ? followed with any 0+ chars, and the whole match will get replaced with an empty string.

这篇关于使用REGEXP_REPLACE从Google Data Studio中的URL剥离查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆