如何判断URL格式是否符合规范?
2018-10-12 14:11
411 查看
<%
function checkisUrl(tmpString)
dim c,i
checkisUrl = true
tmpString=Lcase(trim(tmpString))
if left(tmpString,7)<>"http://" then tmpString="http://"&tmpString
for i = 8 to Len(checkisUrl)
c = Lcase(Mid(tmpString, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-./\", c) <= 0 and not IsNumeric(c) then
checkisUrl = false
exit function
end if
next
if Left(tmpString, 1) = "." or Right(tmpString, 1) = "." then
checkisUrl = false
exit function
end if
if InStr(tmpString, ".") <= 0 then
checkisUrl = false
response.Write "f3"
exit function
end if
if InStr(checkisUrl, "..") > 0 then
checkisUrl = false
end if
end function
%>
<%
if checkisUrl(request("u"))=true then
%>恭喜,你的URL通过!
<%
else
%>对不起,你的URL不合乎规范,请重新检查!
<%end if%>
function checkisUrl(tmpString)
dim c,i
checkisUrl = true
tmpString=Lcase(trim(tmpString))
if left(tmpString,7)<>"http://" then tmpString="http://"&tmpString
for i = 8 to Len(checkisUrl)
c = Lcase(Mid(tmpString, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-./\", c) <= 0 and not IsNumeric(c) then
checkisUrl = false
exit function
end if
next
if Left(tmpString, 1) = "." or Right(tmpString, 1) = "." then
checkisUrl = false
exit function
end if
if InStr(tmpString, ".") <= 0 then
checkisUrl = false
response.Write "f3"
exit function
end if
if InStr(checkisUrl, "..") > 0 then
checkisUrl = false
end if
end function
%>
<%
if checkisUrl(request("u"))=true then
%>恭喜,你的URL通过!
<%
else
%>对不起,你的URL不合乎规范,请重新检查!
<%end if%>
[1]
相关文章推荐
- T9 输入法 如何判断拼音是否符合规范
- 如何通过正则表达式判断一组字符串是否符合规范,首字母必须是字母、$、或是下划线
- 安卓笔记---对话框中输入,判断是否符合号码规范,是--跳转拨号盘,否--提示号码不正确
- OK6410如何判断摄像头是否符合UVC+测试摄像头
- 如何判断建设用地是否符合土地利用总体规划?
- Delphi 如何判断在DBGridEh中某格输入数据是否符合约束
- 判断IP、MAC地址是否符合规范
- Delphi 如何判断在DBGridEh中某格输入数据是否符合约束
- [Tool]判断用户输入是否符合规范(大小写0~9数字)
- Intent案例--判断电话号码是否符合规范
- 摘录:java和sql如何判断数据库是否存在
- SQL Server中如何判断一个数据库是否存在
- 如何判断一个非负整数是否是2的幂
- 如何判断链表是否存在环和求链表中间节点
- 在linux下如何判断是否已经安装某个软件?
- 如何判断你是否适合创业
- C语言如何判断一个数是否为素数
- java中如何高效判断两个容器是否有相同元素(时间复杂度为O(1))
- 如何判断项目是否健康?
- 如何判断当前是否在线!