28,406
社区成员
发帖
与我相关
我的任务
分享
<script language="vbscript">
function check_sj(str)
dim reg
set reg = New RegExp
reg.Global=true
reg.Pattern="^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})$"
reg.IgnoreCase = false
str=trim(str)
if reg.Execute(str).count = 0 then
document.write "时间格式不匹配!"
else
document.write "时间格式匹配!"
end if
end function
dim str
str="2009-12-24 23:59:59"
call check_sj(str)
</script>
<%
function check_sj(str)
dim reg
set reg = New RegExp
reg.Global=true
reg.Pattern="^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2})$"
reg.IgnoreCase = false
str=trim(str)
if reg.Execute(str).count = 0 then
response.write "时间格式不匹配!"
else
response.write "时间格式匹配!"
end if
end function
dim str
str="2009-12-24 23:59:59"
call check_sj(str)
%>
ip = Request("ip")
if ip = "" then
错误
end if
ips = split(ip,".")
if ubound(ips) <> 3 then
错误
end if
for i = 0 to ubound(ips)
if not isnumeric(ips(i)) then
错误
exit for
end if
end if
<%
function check(str)
dim reg
set reg = New RegExp
reg.Global=true
reg.Pattern="^(\d+?\.\d+?\.\d+?\.\d+?)$"
reg.IgnoreCase = false
str=trim(str)
if len(str)>20 then
check=false
response.write "长度超过20!"
elseif reg.Execute(str).count = 0 then
response.write "ip格式不匹配!"
else
response.write "ip格式匹配!"
end if
end function
dim str
str="127.000000a.0.1"
call check(str)
%>