Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Extract partial text from a url

moe
6 - Meteoroid

Hello,

 

I am trying to figure out a way to extract a part of text from the below url 

mysites.com?utm_campaign=mycampaign_20160525_en&utm_medium=email&utm_source=google&utm_content=cart

 

How can i just take "utm_medium=email" from this url using Alteryx formula?

 

please let me know

thanks

1 REPLY 1
jdunkerley79
ACE Emeritus
ACE Emeritus

I would suggest using a couple of REGEX tool.

 

First tokenise with expression 

[?&]([^=]*=?[^&]+)

Then parse with a similar expression

([^=]+)=?(.*)

This will break it into field and value.

 

If all you want is that explicit key and value then you can use a Formula tool:

REGEX_Replace([URL], ".*[?&](utm_medium=[^&]+).*", "$1")

 

Attached example does both.

Labels
Top Solution Authors