I'm using GBQ to try and create a regexp to extract just the "tn" value from the below URL examples. The "tn" key could be anywhere in the URL after the "event?" and could technically be any value as well. However, the regexp I'm using (shown below) utilizes two groups and GBQ only allows one so I'm looking for assistance to see how I can make it
I also tried splitting the below URL to try and extract the value from the array but couldn't figure out where to go from there. I feel like the splitting it may be easier, but I want to be sure it ends up not duplicating the data if I unnest it (ideally I wouldn't need to unnest it).
tn=(.+?)(&|$)
select
split(split('https://google.com/d/track/event?upid=12345&url=https://www.mywebsite.com/&val=100.00&cache_buster=15&ps=2&tn=o_rnpp4126','event?')[ordinal(2)],'&')