I am using Google Datastudio to make a CASE
statement to take a multi-words string and split it out into categories. I was asked to use REGEXP_MATCH (nothing else, I know contains
function would be easier).
I need a solution to match the following words:
HouseBrochure
home brochure
HomeBrochure
house brochure
Bathroom brochure
Bathroombrochure
FloorBrochure
floor brochure
To complicate matters, these words come in via a website request system, meaning people can request a house, bathroom and floor brochure in one request. When such requests reach my server, it compiles into a list(string) which looks like this:
# (with the pipes included)
HouseBrochure|Bathroom brochure|floor brochure
This is just an example of 1 request, there are many variations and multiple requests that come through (I've also only included a few of these brochures, there are many more)
I need to separate out all the house brochures
, all the bathroom brochures
and all the floor brochures
etc, so I can count how many requests have been made for each brochure.
Being new to Regex, I have a basic understanding but nowhere near advanced.
My current attempt in Data studio looks like this:
CASE
WHEN REGEXP_MATCH(Event Label,'^.*(HouseBrochure.*|home brochure.*|HomeBrochure.*|house brochure.*).*$') THEN 'Home Brochure'
END
This is just for the home brochure, yet it's not working, can someone help?
Also, as an FYI Datastudio
uses REG2