Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
in the load script i want to add some new fields. I load a field "URL" and want to exctract the domain, subdomain and TLD from each URL by script.
Example:
Domain: qlik.com
SubDomain: help.qlik.com
TLD: com
Somebody know´s the expression?
regards,
sam
I create an expression to extract the Subdomain:
Load
mid("URL", index("URL", '://')+3, index("URL", '/',3)-index("URL", '://')-3) as Subdomain
...
Domain and TLD is difficult, because if i check the extracted Subdomain i could search for Points, but the problem is, that some TLD´s have a Point like "co.uk"
Example - extract the TLD:
help.qlik.co.uk
qlik.co.uk
help.qlik.com
qlik.com
Do you know a solution?
Regards,
sam
Here is an update for the SubDomain expression:
// Wenn das es ein 3. Vorkommen von / gibt, dann lese die Domain bis zum 3 / aus
if(index(varTestURL6, '/',3)>0,mid(varTestURL6, index(varTestURL6, '://')+3, index(varTestURL6, '/',3)-index(varTestURL6, '://')-3),
// Ansonsten prüfe, ob ? und # nicht vorkommen, wenn ja, dann bis ans Ende auslesen
if(index(varTestURL6, '?',1)=0 AND index(varTestURL6, '#',1)=0, 'einfach bis ans ende',
// Ansonsten prüfe, ob ? und # vorkommen
if(index(varTestURL6, '?',1)>0 AND index(varTestURL6, '#',1)>0,
// Wenn ja, dann prüfe, ob ? vor # vorkommt, wenn ja, dann bis ? auslesen, ansonsten bis #
if(index(varTestURL6, '?',1)<index(varTestURL6, '#',1),'bis ?','bis #'),
// Wenn nicht (kann entweder nur ? oder # vorkommen), dann prüfe, ob ? vorkommt, wenn ja, dann bis ? lesen, ansonsten bis #
if(index(varTestURL6, '?',1)>0,'bis ?','bis #')
)))
regards,
sam