In Looker Studio I have two types of urls, which I want to group. URLs are categories and articles looking like:
https://example.com/category1/
https://example.com/category1/article_abc
https://example.com/category2/
https://example.com/category2/article_xyz
I thought about using in the CASE a kind of the following expression:
CASE
WHEN URL ENDS_WITH "category1/" THEN "category1 folder"
WHEN URL COMTAINS "category1" BUT NOT ENDS_WITH "category1/" THEN "category1 url"
END
But I'm pretty sure, that this part with BUT NOT
will not work. What is the right way? Should I maybe make USE of REGEX_MATCH
? Like
CASE
WHEN REGEXP_MATCH(URL, "category1\/$") THEN "category1 folder"
WHEN REGEXP_MATCH(URL, "category1\/.+?") THEN "category1 url"
END
You may try:
CASE
WHEN REGEXP_CONTAINS(URL, "category1/$") THEN "category1 folder"
WHEN REGEXP_CONTAINS(URL, "category1/.+") THEN "category1 url"
END