Data Studio
5.2K members online now
5.2K members online now
Ask questions about Data Studio
Guide Me

Regex - Identify URLs that begin with specific path

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi there,


I'm trying to create a custom dimension for all URLs that begin with the path structure 


/foo, /foo/ , /foo/some-string etc

but not

/foos, /foos/


My current Regex is ^(\/foo)*\/(foo+[^s]+[^#?\s]+)(.*)?(#[\w\-]+)?$ but this gives me the error could not parse formula when implementing as CASE WHEN REGEXP_MATCH(Page, '^(\/foo)*\/(foo+[^s]+[^#?\s]+)(.*)?(#[\w\-]+)?$') THEN "Foo Page" ELSE "Other Page" END


When I test the Regex externally it works fine. Any ideas?




1 Expert replyverified_user
Marked as Best Answer.
Accepted by topic author Cillian D
May 2017

Regex - Identify URLs that begin with specific path

Top Contributor
# 2
Top Contributor

Hi :-)
I ran the following thru a regex tester, you'll need to test it too


Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here