asp匹配网址的正则
更新时间:2023年06月20日 11:23:47 投稿:mdxy-dxy
这篇文章主要介绍了asp匹配网址的正则,需要的朋友可以参考下
判断是不是正确的网址
Function IsValidUrl(str) Dim regEx Set regEx = New RegExp regEx.Pattern = "http(s)?://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?" IsValidUrl = regEx.Test(str) End Function
ASP正则表达式解析出网址中的域名部分
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("//www.jb51.net/abc.html")
到此这篇关于asp匹配网址的正则的文章就介绍到这了,更多相关asp匹配网址内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
最新评论