function Ubbcode (strcontent,ctype)
On Error Resume Next
If Ctype=1 Then
Strcontent = HTMLEncode (strcontent)
Else
Strcontent = strcontent
End If
Dim objregexp
Set objregexp=new REGEXP
Objregexp.ignorecase =true
Objregexp.global=true
If Ctype=1 Then
Objregexp.pattern= "([URL]) (. *?) ([/URL]) "
Strcontent= Objregexp.replace (strcontent, "<a href=" "$" "Target=_blank style= ' Font-family:verdana, Arial, Helvetica, Sans-serif, XXFarEastFont-font-size:14px ' >$2</A> ')
Objregexp.pattern= "([Url= (. *?)]) (.*?) ([/URL]) "
Strcontent= Objregexp.replace (strcontent, "<a href=" "$" "target=_blank>$3</a>")
Objregexp.pattern= "([EMAIL]) (. *?) ([/email]) "
Strcontent= Objregexp.replace (strcontent, "<a href=" "mailto:$2" ">$2</A>")
Objregexp.pattern= "([Email= (. *?)]) (.*?) ([/email]) "
Strcontent= Objregexp.replace (strcontent, "<a href=" "mailto:$2" "target=_blank>$3</a>")
Objregexp.pattern= "([FLASH]) (. *?) ([/flash]) "
Strcontent= Objregexp.replace (strcontent, "<object codebase=http://download.macromedia.com/pub/shockwave/cabs/ flash/swflash.cab#version=4,0,2,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=500 height=400>< PARAM Name=movie value= "" $ "" ><param name=quality value=high><embed src= "" $ "" Quality=high pluginspage= " Http://www.macromedia.com/shockwave/download/index.cgi? P1_prod_version=shockwaveflash ' type= ' Application/x-shockwave-flash ' width=500 height=400>$2</embed>< /object> ")
Objregexp.pattern= "([IMG]) (. *?) ([/img]) "
Strcontent=objregexp.replace (strcontent, "<a Onfocus=this.blur () href=" "$" "Target=_blank>screen.width-660) this.width=screen.width-660" " ></a> ")
' Automatically identify URLs
Objregexp.pattern = "^ (Http|https tutorial |ftp|rtsp|mms):(//|\\) [a-za-z0-9./=?%-&_~ ' @[] ': +!] +)"
Strcontent = Objregexp.replace (strcontent, <a target=_blank href=$1 style= ' Font-family:verdana, Arial, Helvetica, Sans-serif, XXFarEastFont-font-size:14px ' >$1</a> ')
Objregexp.pattern = "((HTTP|HTTPS|FTP|RTSP|MMS):(//|\\) [a-za-z0-9./=?%-&_~ ' @[] ': +!] +)$"
Strcontent = Objregexp.replace (strcontent, <a target=_blank href=$1 style= ' Font-family:verdana, Arial, Helvetica, Sans-serif, XXFarEastFont-font-size:14px ' >$1</a> ')
Objregexp.pattern = "([^>="]) ((HTTP|HTTPS|FTP|RTSP|MMS):(//|\\) [a-za-z0-9./=?%-&_~ ' @[] ': +!] +)"
Strcontent = Objregexp.replace (strcontent, $1<a target=_blank href=$2 style= ' Font-family:verdana, Arial, Helvetica , Sans-serif, XXFarEastFont-font-size:14px ' >$2</a> ')
Objregexp.pattern= "([HTML]) (. *?) ([/html]) "
Strcontent=objregexp.replace (strcontent, "<span><p> The HTML code snippet that accompanies this article is as follows: <br><textarea style= "" width:94%; Background-color: #f7f7f7 "" "Name=textfield rows=10>$2</textarea><br><input onclick=runEx () type= Button value= Run this code name=button> [Ctrl + a ALL SELECT hint: You can modify some of the code, then press the Run]</span><br> ")
Objregexp.pattern= "([Color= (. *?)]) (.*?) ([/color]) "
Strcontent=objregexp.replace (strcontent, "<font color=$2>$3</font>")
Objregexp.pattern= "([Face= (. *?)]) (.*?) ([/face]) "
Strcontent=objregexp.replace (strcontent, "<font face=$2>$3</font>")
Objregexp.pattern= "([Align= (. *?)]) (.*?) ([/align]) "
Strcontent=objregexp.replace (strcontent, "<div align=$2>$3</div>")
Objregexp.pattern= "([QUOTE]) (. *?) ([/quote]) "
Strcontent=objregexp.replace (strcontent, "<blockquote><font size=1 face=" "Verdana, Arial" ">quote:</ Font>Objregexp.pattern= "([Fly]) (. *?) ([/fly]) "
Strcontent=objregexp.replace (strcontent, "<marquee width=90% behavior=alternate scrollamount=3>$2</ Marquee> ")
Objregexp.pattern= "([Move]) (. *?) ([/move]) "
Strcontent=objregexp.replace (strcontent, "<marquee scrollamount=3>$2</marquee>")
Objregexp.pattern= "([glow= (. *?), (. *?), (. *?)]) (.*?) ([/glow]) "
Strcontent=objregexp.replace (strcontent, "<table width=$2 style=" "Filter:glow (color=$3, strength=$4)" ">$5 </table> ")
Objregexp.pattern= "([shadow= (. *?), (. *?), (. *?)]) (.*?) ([/shadow]) "
Strcontent=objregexp.replace (strcontent, "<table width=$2 style=" "Filter:shadow (color=$3, direction=$4)" ">$5 </table> ")
Objregexp.pattern= "([i]) (. *?) ([i])
Strcontent=objregexp.replace (strcontent, "<i>$2</i>")
Objregexp.pattern= "([u]) (. *?) ([/u]) "
Strcontent=objregexp.replace (strcontent, "<u>$2</u>")
Objregexp.pattern= "([b]) (. *?) ([/b]) "
Strcontent=objregexp.replace (strcontent, "<b>$2</b>")
Objregexp.pattern= "([Fly]) (. *?) ([/fly]) "
Strcontent=objregexp.replace (strcontent, "<marquee>$2</marquee>")
Objregexp.pattern= "([size=1]) (. *?) ([/size]) "
Strcontent=objregexp.replace (strcontent, "<font size=1>$2</font>")
Objregexp.pattern= "([size=2]) (. *?) ([/size]) "
Strcontent=objregexp.replace (strcontent, "<font size=2>$2</font>")
Objregexp.pattern= "([size=3]) (. *?) ([/size]) "
Strcontent=objregexp.replace (strcontent, "<font size=3>$2</font>")
Objregexp.pattern= "([size=4]) (. *?) ([/size]) "
Strcontent=objregexp.replace (strcontent, "<font size=4>$2</font>")
Strcontent = Docode (strcontent, "[List]", "[/list]", "<ul>", "</ul>")
Strcontent = Docode (Strcontent, "[List=1]", "[/list]", "<ol type=1>", "</ol id=1>")
Strcontent = Docode (Strcontent, "[List=a]", "[/list]", "<ol type=a>", "</ol id=a>")
Strcontent = Docode (Strcontent, "[*]", "[/*]", "<li>", "</li>")
Strcontent = Docode (strcontent, [code] "," [/code] "," <pre id=code><font size=1 face= "" Verdana, Arial "" Id=code > "," </font id=code></pre id=code> ")
End If
If ctype=1 or ctype=2 then
Objregexp.pattern= "[Upload= (Gif|jpg|jpeg|bmp|png)] (. [ ^[]*) (gif|jpg|jpeg|bmp|png) [/upload] "
Strcontent= Objregexp.replace (strcontent, "<br><a href=" "$2$1" "Target=_blank>screen.width-333) this.width=screen.width-333 "" > </A> ")
Objregexp.pattern= "[Upload= (. [ ^[]*)](. [^[]*) [/upload] "
Strcontent= Objregexp.replace (strcontent, "<br> <a href=" "$" "style= ' Font-family:verdana, Arial, Helvetica, Sans-serif, XXFarEastFont-Franklin; Font-size:14px ' target=_blank> Click to browse Related Documents </a> ")
End If
Set objregexp=nothing
Ubbcode=strcontent
End Function