end function '网址验证 Function CheckUrl(str) Dim re,a Set re = New RegExp re.Pattern = "^https?:\/\/[\u4E00-\u9FA5a-zA-Z\.\/0-9]{3,}[\u4E00-\u9FA5a-zA-Z\/0-9]{2,}$" re.IgnoreCase = False a = re.Test(str) If a Then CheckUrl = true Else CheckUrl = false End If End Function %> </div>
我发现这样的表达式在域名含有划线-的时候无法通过验证,求修改,允许域名中含有-
最新回答
为你衣冠
2024-09-25 09:49:38
<script type="text/vbscript"> //<![CDATA[
Function CheckUrl(str) Dim re Set re = New RegExp re.Pattern = "^[a-zA-z]+:\/\/(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$" re.IgnoreCase = False re.Global = False CheckUrl = re.Test(str) End Function