Home > Enterprise >  BigQuery Error: Cannot parse regular expression
BigQuery Error: Cannot parse regular expression

Time:09-16

I don't understand what is wrong with my syntax.

relevant portion of query:

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

Error:

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

CodePudding user response:

Try below instead

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          

Note the proposed fix: "'" instead of '''

  • Related