您的位置:首页 > 编程语言 > ASP

ASP正则表达式解析出网址中的域名部分函数

2008-04-06 23:15 375 查看
<%
Function getDomain(domain)
Dim re,ReturnStr,Matches
Set re=new RegExp
re.IgnoreCase =True
re.Global=True

re.Pattern = "(/w+/.(com.cn|net.cn|com|cn|net|org))"
Set Matches = re.Execute(domain)
ReturnStr = ""
For Each Match in Matches
ReturnStr = Match.Value
Exit for
Next
getDomain = ReturnStr
Set re=Nothing
End Function
response.write getDomain("http://www.QQView.com/abc.htmlhttp://www.bak.baidu.com.cn/abc.html")
%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: