首页 > 解决方案 > BigQuery 错误:无法解析正则表达式

问题描述

我不明白我的语法有什么问题。

查询的相关部分:

COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'), ''', '') = 'TAP_RIGHT') AS is_view_ctx_tap_right, COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'), ''', '') = 'TAP_LEFT') AS is_view_ctx_tap_left

错误:

Cannot parse regular expression: unexpected ): , '') = 'TAP_RIGHT') AS is_view_ctx_tap_right, COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'),

标签: sqlgoogle-bigquery

解决方案


在下面尝试

COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'), "'", '') = 'TAP_RIGHT') AS is_view_ctx_tap_right, 
COUNTIF(REGEXP_REPLACE(JSON_EXTRACT(view_context, '$.exit_event'), "'", '') = 'TAP_LEFT') AS is_view_ctx_tap_left          

注意建议的修复:"'"而不是'''


推荐阅读