Data Studio
3K members online now
3K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

CASE with REGEXP

Follower ✭ ✭ ✭
# 1
Follower ✭ ✭ ✭

Hi, I'm having problem in creating a field, that cleans my Landing Page URLs a bit (Data Source is GA)

 

CASE WHEN REGEXP_MATCH(Landing Page, '^.*\\?.*$') THEN REGEXP_EXTRACT(Landing Page, '^(.+)\\?') ELSE Landing Page END

 

What this does - is leaves the URL as it is, if it's not got a ?variable=xxxxxx type ending to it, and if it does have valuetrack variables - cleans everything starting with "?" questionmarks. Each REGEXP works well when tested separately, but adding the full CASE formula - it's just "Invalid Formula"

 

Am I missing an elephant in a room or smth?

CASE with REGEXP

Follower ✭ ✭ ✭
# 2
Follower ✭ ✭ ✭

Syntax should also be correct in this case:

 

CASE WHEN REGEXP_MATCH(Landing Page, '^.*\\?.*$') THEN REGEXP_EXTRACT(Landing Page, '^(.+)\\?') ELSE REGEXP_EXTRACT(Landing Page, '^(.*)$')  END

 

But - just does not work...