sql - 在 Redshift 中使用 regex_match 的问题
问题描述
我正在使用以下代码进行正则表达式匹配,但出现此错误:
错误:
无效操作:函数 regexp_matches(character varying, character varying) 不存在;
代码:
WHEN REGEXP_MATCHes (tdahw.referrer, 'www.*/'::text) IS NOT NULL AND REGEXP_MATCHes(tdahw.event_value, 'www.*/'::text) = REGEXP_MATCHes(tdahw.referrer, 'www.*/'::text) AND tdahw.rolling_count = 1 THEN 'Direct'::text
WHEN REGEXP_MATCHes(tdahw.referrer, 'www.*/'::text) IS NOT NULL AND REGEXP_MATCHes(tdahw.event_value, 'www.*/'::text) <> REGEXP_MATCHes(tdahw.referrer, 'www.*/'::text) AND tdahw.rolling_count = 1 THEN 'Referrer'::text
WHEN REGEXP_MATCHes(tdahw.referrer, 'www.*/'::text) IS NULL THEN 'Referrer'::text
如何纠正?
解决方案
使用~
:
WHEN tdahw.referrer ~ 'www.*/'::text AND
tdahw.event_value ~ 'www.*/'::text AND
tdahw.referrer ~ 'www.*/'::text AND
tdahw.rolling_count = 1
推荐阅读
- html - 如何在CSS中的元素周围制作未完成的边框?
- pandoc - Pandoc:引用完整来源
- python - Python计算滚动函数
- html - CSS 类取消了 text-align 属性
- python - 如何让熊猫将我的 xlsx 文件识别为多列 datafrane
- python - 如何以更快的方式与列表比较从多个 tsv 文件中删除行?
- vue.js - 如何访问其中包含连字符的URL查询vue js
- python - 无法按列分组并返回部门名称,分别有员工人数和薪资范围
- html - HTML5 输入 type="number" 阿拉伯数字
- jquery - SharePoint Online - SPFx - 如何在 PnPjs 中使用 GroupBy