Hi,
What part of the URL are you trying to extract?
I’ve always found regular expressions (in LookML) very helpful for things like this but if you’re looking to do this in a table function, you’ll probably need to use:
replace(substring(${string},if(position(${string},"://")=0,1,position(${string},"://")+3),len(${string})),"www.","")
That’ll give you the domain without the usual gumf at the beginning. You can then trim-off anything after the slash:
if(position(replace(substring(${string},if(position(${string},"://")=0,1,position(${string},"://")+3),len(${string})),"www.",""),"/")=0,replace(substring(${string},if(position(${string},"://")=0,1,position(${string},"://")+3),len(${string})),"www.",""),substring(replace(substring(${string},if(position(${string},"://")=0,1,position(${string},"://")+3),len(${string})),"www.",""),1,position(replace(substring(${string},if(position(${string},"://")=0,1,position(${string},"://")+3),len(${string})),"www.",""),"/")-1)
It’s messy, but I hope it helps!
(Revised double quote characters)