28,391
社区成员
发帖
与我相关
我的任务
分享
str1="<!--if aaa>1 then-->aaa <!--else-->bbb <!--end if-->"
str2="<!-- if aaa>1 then -->aaa <!-- else -->bbb <!-- end if -->"
str3="<!-- if aaa>1 then-->aaa <!-- else -->bbb <!--end if -->"
str4="<!--if aaa>1 then -->aaa <!--else -->bbb <!--end if --> "
Set re = New RegExp
re.Global = True
re.Pattern = "<!--\s*if(.*?)end\s*if\s*-->"
response.Write re.test(str1)&"<br>"
response.Write re.test(str2)&"<br>"
response.Write re.test(str3)&"<br>"
response.Write re.test(str4)
<!--\s*if.*?end\s*if\s*-->
s = "<!--if aaa>1 then-->aaa <!--else-->bbb <!--end if-->"&_
"<!-- if aaa>1 then -->aaa <!-- else -->bbb <!-- end if -->"&_
"<!-- if aaa>1 then-->aaa <!-- else -->bbb <!--end if -->"&_
"<!--if aaa>1 then -->aaa <!--else -->bbb <!--end if -->"
Set re = New RegExp
With re
.Global = True
.IgnoreCase = True
.MultiLine = True
.Pattern = "<!--\s*if .*?end if\s*-->"
Set col = .Execute(s)
End With
For Each m In col
Response.Write m.Value & "<br>" & VbCrLf
Next