Reputation: 21
I have a filed with a string that is pipe-delimited like this: value 1|value 2|value 3
In Datastudio I'm trying this method I found on here, creating a custom field and using this:
REGEXP_EXTRACT(Event Label, '^(?:[^\\|]*_){0}([^\\|]*)')
This works to return the first value. However, I'm not able to do this to return value 2 or value 3, etc. This does not work:
REGEXP_EXTRACT(Event Label, '^(?:[^\\|]*_){1}([^\\|]*)')
Upvotes: 0
Views: 1157
Reputation: 1
I think there is a limit here that you can only extract ONE of the values in the string. Otherwise, it would break the model of how data studio works (table based). no?
If you have found that you CAN create a new custom field from more than one value, I would like to learn how you have done this!
Upvotes: 0
Reputation: 21
The solutuion in case anyone else finds this:
REGEXP_EXTRACT(Event Label, '^(?:[^\\|]+\\|){1}([^\\|]+)')
This works to extract the segment of a pipe-delimited string in Google Data Studio. Just change the number to the segment - 1 (first segment is 0).
Upvotes: 1