复制代码 代码如下:
<%
FunctionUBBCode(strContent)
IfisEmpty(strContent)OrisNull(strContent)Then
ExitFunction
Else
dimregex,strMatch
setregex=newRegExp
regex.IgnoreCase=True
regex.Global=True
regex.Pattern="[html]((rn)?([sS]+?))[/html]"
SetstrMatchs=regex.Execute(strContent)
ForEachstrMatchinstrMatchs
'response.writestrMatch.SubMatches(3)
Randomize
rndID="runcode"&Int(100000*Rnd)
strContent=Replace(strContent,strMatch.Value,"
[Ctrl+A全部选择提示:你可先修改部分代码,再按运行]")
Next
SetstrMatchs=nothing
'去空行
regex.pattern="n[s]*r"
SetstrMatchs=regex.Execute(strContent)
ForEachstrMatchinstrMatchs
strContent=Replace(strContent,strMatch.Value,"")
Next
'代码块
regex.Pattern="[code]((rn)?([sS]+?))[/code]"
SetstrMatchs=regex.Execute(strContent)
ForEachstrMatchinstrMatchs
Randomize
rndID="code"&Int(100000*Rnd)
strContent=Replace(strContent,strMatch.Value,"