I am trying to get specific part of a url from my website in data studio. This is the url type:
https://mywebsite.com/acs/region/USA/news/asdf.com
https://mywebsite.com/acs/region/ARG/news/asdf2.com
https://mywebsite.com/acs/dtcp/en-us/news/asdf3.com
And I would like to get:
region/USA
region/ARG
dtcp/en-us/
This is the code that I tried it:
/[a-zA-Z]+/[a-zA-Z]+/
But in data studio print NULL.
>Solution :
You can use
/acs/([^/]+/[^/]+)/
See the regex demo. Details:
/acs/– a literal string([^/]+/[^/]+)– Group 1: any one or more chars other than/,/and then again one or more chars other than//– a/char