UBB.asp代码如下:
<%
Const MaxLoopcount=50
function ubb(bod) 'h=2为转换帖,h=1为转换签名
Set re=new RegExp '声明正则表达式对象
re.IgnoreCase =true '设置是否区分字符大小写
re.Global=True '设置全区可用性
're.pattern 设置模式
bod = dvHTMLEncode(bod)
re.Pattern="(javascript)"
bod=re.Replace(bod,"<I>javascript</I>")
re.Pattern="(jscript:)"
bod=re.Replace(bod,"<I>jscript:</I>")
re.Pattern="(js:)"
bod=re.Replace(bod,"<I>js:</I>")
re.Pattern="(value)"
bod=re.Replace(bod,"<I>value</I>")
re.Pattern="(about:)"
bod=re.Replace(bod,"<I>about:</I>")
re.Pattern="(file:)"
bod=re.Replace(bod,"<I>file:</I>")
re.Pattern="(document.cookie)"
bod=re.Replace(bod,"<I>documents.cookie</I>")
re.Pattern="(vbscript:)"
bod=re.Replace(bod,"<I>vbscript:</I>")
re.Pattern="(vbs:)"
bod=re.Replace(bod,"<I>vbs:</I>")
re.Pattern="(on(mouse|exit|error|click|key))"
bod=re.Replace(bod,"<I>on$2</I>")
'常用标签
re.Pattern="(\[humor)([\d]+)(\])"
bod=re.replace(bod,"<img src=""images/humor/$2.gif"" border=""0"">")
re.Pattern="\[QUOTE\](.*)\[\/QUOTE\]"
bod=re.Replace(bod,"<table style=""border-collapse:collapse;width:100%"" bordercolor=""#6595D6"" cellpadding=5 cellspacing=0 border=1><tr><td bgcolor=""#E4E8EF"" width=""100%"">$1</td></tr></table>")
re.Pattern = "(\[SIZE=([0-9]*)\])(.[^\[]*)(\[\/SIZE\])"
bod=re.Replace(bod,"<FONT SIZE='$2'>$3</FONT>")
re.Pattern = "(\[B\])(.[^\[]*)(\[\/B\])"
bod=re.Replace(bod,"<B>$2</B>")
re.Pattern = "(\[COLOR=(.[^\[]*)\])(.[^\[]*)(\[\/RED\])"
bod=re.Replace(bod,"<FONT COLOR='$2'>$3</FONT>")
re.Pattern = "(\[RED\])(.[^\[]*)(\[\/RED\])"
bod = re.Replace(bod,"<FONT COLOR='#FF0000'>$2</FONT>")
re.Pattern = "(\[GREEN\])(.[^\[]*)(\[\/GREEN\])"
bod = re.Replace(bod,"<FONT COLOR='#009900'>$2</FONT>")
re.Pattern = "(\[BLUE\])(.[^\[]*)(\[\/BLUE\])"
bod = re.Replace(bod,"<FONT COLOR='#000099'>$2</FONT>")
re.Pattern = "(\[GRAY\])(.[^\[]*)(\[\/GRAY\])"
bod = re.Replace(bod,"<FONT COLOR='#999999'>$2</FONT>")
re.Pattern = "(\[S\])(.[^\[]*)(\[\/S\])"
bod= re.Replace(bod,"<FONT STYLE='TEXT-DECORATION:LINE-THROUGH'>$2</FONT>")
re.Pattern = "(\[I\])(.[^\[]*)(\[\/I\])"
bod = re.Replace(bod,"<I>$2</I>")
re.Pattern = "(\[U\])(.[^\[]*)(\[\/U\])"
bod = re.Replace(bod,"<U>$2</U>")
re.Pattern = "(\[ALIGN=(.[^\[]*)\])(.[^\[]*)(\[\/ALIGN\])"
bod = re.Replace(bod,"<DIV ALIGN='$2'>$3</DIV>")
re.Pattern = "(\[CENTER\])(.[^\[]*)(\[\/CENTER\])"
bod= re.Replace(bod,"<CENTER>$2</CENTER>")
re.Pattern = "\[url=(.[^\]]*)\](.[^\[]*)\[\/url]"
bod = re.Replace(bod,"<img align=absmiddle src=images/url.gif border=0><a target=_blank style=font-size:9pt href=$1>$2</a>")
re.Pattern = "\[url](.[^\[]*)\[\/url]"
bod = re.Replace(bod,"<img align=absmiddle src=images/url.gif border=0><a target=_blank style=font-size:9pt href=$1>$1</a>")
re.Pattern = "\[email=(.[^\]]*)\](.[^\[]*)\[\/email]"