Code: Select all
function URLComponents pURL
local tSchema, tAuthority, tPath, tQuery, tFragment, tTemp
get matchText(pURL, "^(([^:\/?#]+):)?(\/?\/?([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$", tTemp, tSchema, tTemp, tAuthority, tPath, tTemp, tQuery, tTemp, tFragment)
local tUserInfo, tHost, tPort
get matchText(tAuthority, "(?:((?:[A-Za-z0-9\-._~!$&\'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?((?:[A-Za-z0-9\-._~!$&\'()*+,;=]|%[0-9A-Fa-f]{2})+)(?::([0-9]*))?", \
tUserInfo, tHost, tPort)
local tResults
put tSchema into tResults["Schema"]
put tUserInfo into tResults["UserInfo"]
put tHost into tResults["Host"]
put tPort into tResults["Port"]
put tPath into tResults["Path"]
put tQuery into tResults["Query"]
put tFragment into tResults["Fragment"]
return tResults
end URLComponents