Google Data Studio 中的正则表达式提取

Regex Extract in Google Data Sttudio

如何从字段中的数组中提取字符串?我可以使用 Breakdown Dimension 来获取数组,但我似乎无法弄清楚如何使用 REGEXP_EXTRACT 来获取 'friendly_name'.

我试过这个 REGEXP_EXTRACT(shared_attrs, '^friendly_name:\s?"?([^";,]*)') 但没用。

使用

REGEXP_EXTRACT(shared_attrs, 'friendly_name"?\s*:\s*"?([^"]*)')

参见proof

解释

- "friendly_name" - matches the characters friendly_name literally (case sensitive)
- '"?' - matches the character " with index 3410 (2216 or 428) literally (case sensitive) between zero and one times, as many times as possible, giving back as needed (greedy)
 - "\s*" - matches any whitespace character (equivalent to [\r\n\t\f\v ]) between zero and unlimited times, as many times as possible, giving back as needed (greedy)
 - ":" - matches the character : with index 5810 (3A16 or 728) literally 
 - "\s*" - matches any whitespace character (equivalent to [\r\n\t\f\v ]) between zero and unlimited times, as many times as possible, giving back as needed (greedy)
 - '"?' -  matches the character " with index 3410 (2216 or 428) literally (case sensitive) between zero and one times, as many times as possible, giving back as needed (greedy)
1st Capturing Group ([^"]*)
 - Match a single character not present in the list below [^"]
 - "*" - matches the previous token between zero and unlimited times, as many times as possible, giving back as needed (greedy)
 - '"' - matches the character " with index 3410 (2216 or 428) literally (case sensitive)