Search code examples
regexgoogle-bigquerylooker-studiore2

REGEX_MATCH pattern works everywhere but Google Data Studio


I am trying to understand the implementation of REGEX used in REGEX_MATCH in Google Data Studio. I have a pretty simple pattern that just won't match in Google Data Studio but will succeed in BigQuery and on sites such as regexr.com

The string to match is of the format:

some.job.run | SUCCESS: [{"object_1":20}, {"object_2":0}] (with more items in the list)

In BigQuery I can match the expected results with:

REGEXP_MATCH(input, '^some\\.job\\.run \\| SUCCESS\\:.*')

This is accepted as valid in Google Data Studio but will not match, I had previously read that Google Data Studio requires a full string match - which I do get in BigQuery and regexr.com etc.

Is anyone experienced using REGEX_MATCH in Google Data Studio able to shed some light on why this pattern won't match in Google Data Studio?


Solution

  • You're using legacy SQL (REGEXP_MATCH). Try with Standard SQL (REGEXP_CONTAINS) and that should fix it.

    https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#regexp_contains