28,390
社区成员
发帖
与我相关
我的任务
分享
<%
dim str,reg,arr,flag,str2,str3
flag=0
str="19860103-20000229|20000101-1999010119190504-19491001yes"
str=trim(str)
set reg =New RegExp
reg.Global=true
reg.IgnoreCase = false
reg.Pattern="\d{8}-\d{8}"
if reg.Execute(str).count <> 0 then
set colMatches = reg.Execute(str)
for each match in colMatches
arr=split(match.value,"-")
if clng(arr(0)) < clng(arr(1)) then
str2=left(arr(0),4) & "-" & mid(arr(0),5,2) & "-" & right(arr(0),2)
str3=left(arr(1),4) & "-" & mid(arr(1),5,2) & "-" & right(arr(1),2)
if check(str2)=1 and check(str3)=1 then
response.write(match.value&"<br/>")
flag=1
end if
end if
next
end if
if flag=0 then
response.write("NO SUCH STRING!")
end if
'功能:时间格式判断
'作者:小白
'时间:2009-12-30
function check(str)
dim reg
set reg = New RegExp
reg.Global=true
reg.IgnoreCase = false
reg.Pattern="^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6
-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29))$"
str=trim(str)
if reg.Execute(str).count = 0 then
check=0
else
check=1
end if
end function
%>