<%
'测试是否满足正则表达式
Function RegTest(pattern,strTest)
RegTest = False
Dim regEx, Matchs
Set regEx = New RegExp
regEx.Pattern = pattern
regEx.IgnoreCase = False
regEx.Global = True
RegTest = regEx.Test(strTest)
End Function
'判断是否是IP
Function IsIp(str)
Dim patn
patn = "^(?:(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d?\d)$"
IsIp = RegTest(patn,str)
End Function
'判断是否是域名
Function IsDomain(str)
Dim patn
patn = "^([\u4e00-\u9fa5\w-]+\.)+[\u4e00-\u9fa5\w-]+$"
IsDomain = RegTest(patn,str)
End Function
'判断是否是域名或者IP地址
Function IsDomainOrIP(str)
Dim patn
patn = "^([\u4e00-\u9fa5\w-]+\.)+[\u4e00-\u9fa5\w-]+$|^(?:(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d?\d)$"
IsDomain = RegTest(patn,str)
End Function
%>