1
votes

I need to use RegEx in Google Data Studio.

As part of a project I need to make a dashboard in Google Data Studio, but I'm having trouble extracting different elements from the column:

P. (number) - Title/\\/Author/\\/Topic

Examples:

P. 9 - Harry Pottér sold: 2.2m in 2019/\/John Johnson/\/Movies

P. 120 - The Readers Say, that/\/NA/\/Debat

I need to extract Title, Author and Topic into separate columns.

1

1 Answers

1
votes

Here's one way it could be achieved using 3 REGEXP_EXTRACT fields:

  1. Title
REGEXP_EXTRACT(Field, "^P\\. \\d+ - (.*)/./.*/./.*$")
  1. Author
REGEXP_EXTRACT(Field, "/./(.*)/./\\w+$")
  1. Topic
REGEXP_EXTRACT(Field, "(\\w+)$")

Created a Google Data Studio Report (Google Sheets Embedded) to demonstrate.

3]