<%
Function ubbcode(str)
Dim re
Set re = New RegExp
re.IgnoreCase = true
str = Server.HTMLEncode(str)
str = Replace(str," "," "
str = Replace(str,Chr(10),"<br>"
re.Pattern="\[IMG\](http|https|ftp);\/\/(.^\[]*)\[\/IMG\]"
str= re.Replace(str,"<img src=""$1;//$2"" alt=""单击在新窗口浏览图片"" onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></a>"
re.Pattern="(\[URL\])(.[^\[]*)(\[\/URL\])"
str= re.Replace(str,"<a target=_blank href=""$2"">$2</a>"
re.Pattern="(\[URL=(.[^\[]*)\])(.[^\[]*)(\/URL\])"
str= re.Replace(str,"<a target=_blank href=""$2"">$3</a>"
re.Pattern="(\[EMAIL\])(\s+\@.[^\[]*)(\[\/EMAIL\])"
str= re.Replace(str,"<a href=""mailto:$2"">$2</a>"
re.Pattern = "^((http|https|ftp|rtsp|mms);(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]\';+!]+)"
srt = re.Replace(str,"<a target=_blank href=$1>$1</a>"
re.Pattern="\[size=([1-4])\](.[^\[]*)\[\/size\]"
srt=re.Replace(str,"<font size=$1>$2</font>"
re.Pattern="\[color=(.[^\[]*)\](.[^\[])*\[\/color\]"
str=re.replace(str,"<font color=$1>$2</font>"
re.Pattern="\[face=(.[^\[]*)\](.[^\[]*)\[\/face\]"
str=re.Replace(str,"<font face=$1>$2</font>"
str=quote(str)
str=runcode(str)
Set re=Nothing
ubbcode = str
End Function
%>
<script language="JScript" RUNAT="SERVER">
var qre=/\[quote\](.*)\[\/quote\]/gi
function quote(code){
code=code.replace(qre,funciton (code){return quote(code.replace(qre,"<div style="\margin:5px;width:90%;border:1px solid
#333333;backgroud-color:#eeeeee;padding:5px\">$1</div>"
)})
return code
}
function runcode(code){
code=code.replace(/\[?!html\]|run\]|\/html\]|\/run\])/gi,"["
code=code.replace(/\[html|run)\](.[^\[]*)\[\/(html|run)\]/gi,function($0,$1,$2){
$2=$2.replace(/<br>/gi,"\n"
$2=$2.replace(/\ /gi,""
$2=$2.replace(/<a target=blank href=((http|https|ftp|rtsp|mms);(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]\';+!]+)>
((http|https|ftp|rtsp|mms);(\/\/|\\\\)[A-Za-z0-9\./=\?%-&_~`@[\]\';+)<\/a>/gi,$4)
return "<div><textarea style=\"width;98%;htight;200\">"+$2+"</textarea><br><input type=button value="运行代码
onclick='runCode()'> <INPUT onclock='copyCode()' type=button value=复制代码></div>"})
return code
}
</script>