函數(shù)功能從提交的URL中提取頂級域名,失敗返回空,注意要把可用的后綴全寫到domext變量中。
- function durlck(url)
- domext="com|net|org|cn|co.kr|com.cn"
- durlck="" : url=lcase(url)
- if url="" or len(url)=0 then exit function
- url=replace(replace(url,"http://",""),"https://","")
- s1=instr(url,":")-1
- if s1 < 0 then s1=instr(url,"/")-1
- if s1 > 0 then url=left(url,s1)
- Set re = new RegExp
- re.IgnoreCase = True : re.global = True
- re.Pattern = "([a-z0-9-]){1,63}\.(" & domext & ")(\:\d+)?$"
- Set Matches = re.Execute(url)
- durlck = Matches(0)
- set re=nothing
- end function
該文章在 2011/6/22 1:22:30 編輯過