Search code examples
regexlooker-studiore2

Google data Studio REGEX_MATCH - How to extract string from between strings?


I have a url which is as follows

www.abc.com?utm_term=stack%20overflow&device=mobile

I need to extract stack%20overflow from with the url. I have tried everything but it doesn't work. Any help is appreciated.

I tried the following it doesn't work REGEXP_EXTRACT(URL, "utm_term=\\w+/([\\w-]+)/")


Solution

  • You should be able to achieve it with something like utm_term=([^&]*) which will get every character in between utm_term= and &.

    Example:

    REGEXP_EXTRACT(URL, 'utm_term=([^&]*)')