Google Data Studio中带有计算字段的正则表达式 [英] Regular expression with calculated field in Google Data Studio

查看:85
本文介绍了Google Data Studio中带有计算字段的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下计算所得的字段,但不起作用:

I have the following calculated field but It doesn't work:

sum(CASE WHEN REGEXP_MATCH(url, 'foo') THEN 1 ELSE 0 END)

我的目标是求和所有包含"foo"一词的网址.是否有意义?我的错误在哪里?

My goal is to sum all the url containing the word 'foo'. Does it make sense? Where is my mistake?

推荐答案

由于

You need to use .*foo.* since REGEXP_MATCH requires a full string match:

REGEXP_MATCH 尝试匹配 field_expression 中包含的整个字符串.

REGEXP_MATCH attempts to match the entire string contained in field_expression.

使用

sum(CASE WHEN REGEXP_MATCH(url, '.*foo.*') THEN 1 ELSE 0 END)
                                 ^^   ^^

这篇关于Google Data Studio中带有计算字段的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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