位置:海鸟网 > IT > ASP.NET >

改进后的UBB套件(使用详解)

UBB代码是HTML的一个变种,最初是Ultimate Bulletin Board (国外的一个BBS程序)采用的一种特殊的TAG。
您也许已经对它很熟悉了。UBB代码很简单,功能很少,但是由于其Tag语法检查实现非常容易,所以引入这种代码可以方便在文本中调用显示图片/联接/加粗字体等功能,从而实现动态排版。还有一种在页面中使用UBB的目的就是屏蔽危险的HTML脚本,起到安全提交的作用。

下面这个UBB套件可以直接使用,在需要的页面引入即可。

特点:支持绝大多数页面TAG、支持重复嵌套、支持高级模式插入-自动文本识别、高级模式取色

内容:getubb.asp
mycode.asp
ubbpic 图片包

文件打包下载:

上传的附件

56ade0e938cc6d88d60f751316b6c764.rar (27.28 KB)



使用方法:

在添加记录的页面调用UBB/注意高亮部分
操作很简单,与表单配合使用,注意这里UBB标签是添加到名为Content的文本域中

1. 引入UBB套件
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
... ...
... ...
<form action="savenews.asp" method="POST"> <table>
<tr>
<td>UBB 标签:</td>
<td colspan="2"><!--#include file="getubb.asp" --></td>
</tr>
<tr>
<td rowspan="2">文章内容:</td>
<td colspan="2"><textarea cols="63" rows="10"></textarea></td>
</tr>
<tr>
<td valign="top"> <input type="submit" value="提交">
<img src="http://www.chinahtml.com/images/spacer.gif">
<input type="reset" value="重置">
<img src="http://www.chinahtml.com/images/spacer.gif"> </td>
<td valign="top"><table cellpadding="0" cellspacing="1">
<tr>
<td><a href=# onClick=history.go(-1)> <strong>返回</strong></a></td>
</tr>
</table></td>
</tr>
</table></form>



2. getubb.asp 内容 / 注意将图片路径改为你的实际情况

<SELECT name=font>
<option value="宋体" selected>字体类型</option>
<OPTION>========</OPTION>
<option value="宋体">宋体</option>
<option value="楷体_GB2312">楷体</option>
<option value="新宋体">新宋体</option>
<option value="黑体">黑体</option>
<option value="隶书">隶书</option>
<OPTION value="Andale Mono">Andale Mono</OPTION>
<OPTION value=Arial>Arial</OPTION>
<OPTION value="Arial Black">Arial Black</OPTION>
<OPTION value="Book Antiqua">Book Antiqua</OPTION>
<OPTION value="Century Gothic">Century Gothic</OPTION>
<OPTION value="Comic Sans MS">Comic Sans MS</OPTION>
<OPTION value="Courier New">Courier New</OPTION>
<OPTION value=Georgia>Georgia</OPTION>
<OPTION value=Impact>Impact</OPTION>
<OPTION value=Tahoma>Tahoma</OPTION>
<OPTION value="Times New Roman" >Times New Roman</OPTION>
<OPTION value="Trebuchet MS">Trebuchet MS</OPTION>
<OPTION value="Script MT Bold">Script MT Bold</OPTION>
<OPTION value=Stencil>Stencil</OPTION>
<OPTION value=Verdana>Verdana</OPTION>
<OPTION value="Lucida Console">Lucida Console</OPTION>
</SELECT>
<select>
<option value="3" selected>字体大小</option>
<OPTION>=====</OPTION>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
 <br>
<img onclick=Cbold() src="http://www.chinahtml.com/dovia/ubbpic/icon_editor_bold.gif" alt="粗体">
<img onclick=Citalic() src="http://www.chinahtml.com/dovia/ubbpic/icon_editor_italicize.gif" alt="斜体">
<img onclick=Cunder() src="http://www.chinahtml.com/dovia/ubbpic/icon_editor_underline.gif" alt="下划线">
<img onclick=Ccenter() src="http://www.chinahtml.com/dovia/ubbpic/icon_editor_center.gif" alt="居中">
<img onclick=Curl() src="http://www.chinahtml.com/dovia/ubbpic/icon_editor_url.gif" alt="超级连接">
<img onclick=Cemail() src="http://www.chinahtml.com/dovia/ubbpic/icon_editor_email.gif" alt="Email连接">
<img onclick=Cimage() src="http://www.chinahtml.com/dovia/ubbpic/icon_editor_image.gif" alt="图片">
<img onclick=Cswf() src="http://www.chinahtml.com/dovia/ubbpic/swf.gif" alt="Flash图片">
<img onclick=Cdir() src="http://www.chinahtml.com/dovia/ubbpic/sk.gif" alt="Shockwave文件">
<img onclick=Crm() src="http://www.chinahtml.com/dovia/ubbpic/rm.gif" alt="realplay视频文件">
<img onclick=Cwmv() src="http://www.chinahtml.com/dovia/ubbpic/mp.gif" alt="Media Player视频文件">
<img onclick=Cmov() src="http://www.chinahtml.com/dovia/ubbpic/qt.gif" alt="QuickTime视频文件">

<img onclick=Ccode() src="http://www.chinahtml.com/dovia/ubbpic/icon_editor_quote.gif" alt="代码">
<IMG onclick=Cfly() height=22 alt=飞行字 src="http://www.chinahtml.com/dovia/ubbpic/fly.gif" width=23 border=0>
<IMG onclick=Cmarquee() height=22 alt=移动字 src="http://www.chinahtml.com/dovia/ubbpic/move.gif" width=23 border=0>
<IMG onclick=Cguang() height=22 alt=发光字 src="http://www.chinahtml.com/dovia/ubbpic/glow.gif" width=23 border=0>
<IMG onclick=Cying() height=22 alt=阴影字 src="http://www.chinahtml.com/dovia/ubbpic/shadow.gif" width=23 border=0>
<img onclick=Csound() src="http://www.chinahtml.com/dovia/ubbpic/csound.gif" alt="背景音乐">
<br>
<SCRIPT language=JavaScript>
//Made by mat

function MM_findObj(n, d) {
 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
 for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function insertTag(MyString)
{
fontbegin='<font color="' + MyString + '">'
fontend='</font>'
fontchuli();
}

function fontchuli(){
if ((document.selection)&&(document.selection.type == "Text")) {
var range = document.selection.createRange();
var ch_text=range.text;
range.text = fontbegin + ch_text + fontend;
}
else {
document.frmAnnounce.Content.value=fontbegin+document.frmAnnounce.Content.value+fontend;
document.frmAnnounce.Content.focus();
}
}

var base_hexa = "0123456789ABCDEF";
function dec2Hexa(number)
{
 return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);
}

function RGB2Hexa(TR,TG,TB)
{
 return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);
}
function lightCase(MyObject,objName)
{
 MM_findObj(objName).bgColor = MyObject.bgColor;
}

function lightCase1(MyObject,objName)
{
 MM_findObj(objName).value = MyObject.bgColor;
}

col = new Array;
col[0] = new Array(255,0,255,-1,255,-1);
col[1] = new Array(255,0,0,1,0,0);
col[2] = new Array(255,-1,255,0,0,0);
col[3] = new Array(0,0,255,0,0,1);
col[4] = new Array(0,0,255,-1,255,0);
col[5] = new Array(0,1,0,0,255,0);
col[6] = new Array(255,-1,0,0,255,-1);

function rgb(pas,w,h){
 for (j=0;j<6+1;j++){
  for (i=0;i<pas+1;i++){
   r = Math.floor(col[j][0]+col[j][1]*i*(255)/pas);
   g = Math.floor(col[j][2]+col[j][3]*i*(255)/pas);
   b = Math.floor(col[j][4]+col[j][5]*i*(255)/pas);
   codehex = r + '' + g + '' + b;
   document.write('<td bgColor="' + RGB2Hexa(r,g,b) + '"><IMG border=0 title="<FONT COLOR='+RGB2Hexa(r,g,b)+'>字体颜色:'+RGB2Hexa(r,g,b)+'</FONT>"></TD>\n');
  }
 }
}

function rgb1(pas,w,h){
for (j=0;j<6+1;j++){
  for (i=0;i<pas+1;i++)
 {
 r = Math.floor(col[j][0]+col[j][1]*i*(255)/pas);
 g = Math.floor(col[j][2]+col[j][3]*i*(255)/pas);
 b = Math.floor(col[j][4]+col[j][5]*i*(255)/pas);
 codehex = r + '' + g + '' + b;
 document.write('<td bgColor="' + RGB2Hexa(r,g,b) + '"><IMG border=0 title="<FONT COLOR='+RGB2Hexa(r,g,b)+'>标题颜色:'+RGB2Hexa(r,g,b)+'</FONT>"></TD>\n');
 }}}

function search(text,caract)
{
 for(i=0;i<text.length;i++)
 {
  if (caract == text.substring(i,i+1))
  return i+1;
 }
}
</SCRIPT>
<SCRIPT language=JavaScript>
 var height1 = 10; // define the height of the color bar
 var pas = 36;   // define the number of color in the color bar
 var width1=2;
          //define the width of the color bar here (for forum with little width put 1)
</SCRIPT>
<TABLE id=ColorPanel cellSpacing=0 cellPadding=0 align=left border=0 >
 <TBODY>
 <TR><TD id=ColorUsed vAlign=center align=middle><SCRIPT language=JavaScript>document.write('<IMG width=20 border=1></TD>');</SCRIPT></TD><SCRIPT language=JavaScript>rgb(pas,width1,height1)</SCRIPT></TR>
 </TBODY>
</TABLE>

3. UBB套件引入后测试这个添加记录的页面,你应该看到以下类似的页面



接下来,我们要在显示(细节)页面调用UBB,使它格式化文本,起到我们需要的作用。

1. 在细节页面引入解释UBB标签的mycode.asp、并代用格式化函数,注意红色高亮部分
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<!--#include file="mycode.asp" -->

... ...
... ...
<table>
<tr>
<td>
<%=DvBCode(rsnews.Fields.Item("ntColor").Value)%>
</table>
</tr>
</td>

2. mycode 内容

<%
function UBB_IMG(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="

改进后的UBB套件(使用详解)"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/IMG" & chr(2))
   re.Pattern="x01IMGx02(.[^x01]*)x01/IMGx02"
  
    strContent=re.Replace(strContent,"<a onfocus=this.blur() href=""$1"" target=_blank><IMG SRC=""$1"" border=0 alt=按此在新窗口浏览图片javascript:if(this.width>screen.width-400)this.width=screen.width-400""></a>")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_IMG=strContent
end function

function UBB_UPLOAD(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[UPLOAD=(gif|jpg|jpeg|bmp|png)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "UPLOAD=$1" & chr(2))
  re.Pattern="[/UPLOAD]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/UPLOAD" & chr(2))
   re.Pattern="x01UPLOAD=(gif|jpg|jpeg|bmp|png)x02(.[^x01]*)x01/UPLOADx02"
 
    strContent= re.Replace(strContent,"<br><IMG SRC=""http://www.chinahtml.com/images/pic/gift.gif"" border=0>此主题相关图片如下:<br><A HREF=""$2"" TARGET=_blank><IMG SRC=""$2"" border=0 alt=按此在新窗口浏览图片javascript:if(this.width>screen.width-400)this.width=screen.width-400""></A>")
 
   re.Pattern="[UPLOAD=(.[^[]*)]"
   strContent=re.replace(strContent, chr(1) & "UPLOAD=$1" & chr(2))
   re.Pattern="x01UPLOAD=(.[^x01]*)x02(.[^x01]*)x01/UPLOADx02"
   strContent= re.Replace(strContent,"<br><IMG SRC=""http://www.chinahtml.com/images/pic/gift.gif"" border=0> <a href=""$2"">点击浏览该文件</a>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 re.Pattern="[UPLOAD=(.[^[]*)](.[^[]*)[/UPLOAD]"
    strContent= re.Replace(strContent,"<br><IMG SRC=""http://www.chinahtml.com/images/pic/gift.gif"" border=0> <a href=""$2"">点击浏览该文件</a>")
 set re=Nothing
 UBB_UPLOAD=strContent
end function

function UBB_DIR(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[DIR=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "DIR=$1,$2" & chr(2))
  re.Pattern="[/DIR]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/DIR" & chr(2))
  
    re.Pattern="x01DIR=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/DIRx02"
    strContent=re.Replace(strContent,"<object classid=clsid:166B1BCA-3F9C-11CF-8075-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0 width=$1 height=$2><param name=src value=$3><embed src=$3 pluginspage=http://www.macromedia.com/shockwave/download/ width=$1 height=$2></embed></object>")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_DIR=strContent
end function

function UBB_QT(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[QT=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "QT=$1,$2" & chr(2))
  re.Pattern="[/QT]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/QT" & chr(2))
  
    re.Pattern="x01QT=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/QTx02"
    strContent=re.Replace(strContent,"<embed src=$3 width=$1 height=$2 autoplay=true loop=false controller=true playeveryframe=false cache=false scale=TOFIT bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>")
 
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_QT=strContent
end function

function UBB_MP(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[MP=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "MP=$1,$2" & chr(2))
  re.Pattern="[/MP]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/MP" & chr(2))
   
    re.Pattern="x01MP=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/MPx02"
    strContent=re.Replace(strContent,"<object align=middle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=$1 height=$2 ><param name=ShowStatusBar value=-1><param name=Filename value=$3><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src=$3 width=$1 height=$2></embed></object>")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_MP=strContent
end function

function UBB_RM(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[RM=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "RM=$1,$2" & chr(2))
  re.Pattern="[/RM]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/RM" & chr(2))
  
    re.Pattern="x01RM=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/RMx02"
    strContent=re.Replace(strContent,"<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width=$1 height=$2><PARAM NAME=SRC VALUE=$3><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=true></OBJECT><br><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=32 id=video2 width=$1><PARAM NAME=SRC VALUE=$3><PARAM NAME=AUTOSTART VALUE=-1><PARAM NAME=CONTROLS VALUE=controlpanel><PARAM NAME=CONSOLE VALUE=Clip1></OBJECT>")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_RM=strContent
end function

function UBB_FLASH(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern=""
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/FLASH" & chr(2))
  
    re.Pattern="x01FLASHx02(.[^x01]*)x01/FLASHx02"
    strContent=re.Replace(strContent,"<a href=""$1"" TARGET=_blank><IMG SRC=http://www.chinahtml.com/images/pic/music.gif border=0 alt=点击开新窗口欣赏该FLASH动画! height=16 width=16>[全屏欣赏]</a><br><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=""$1""><PARAM NAME=quality VALUE=high><embed src=""$1"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=500 height=400>$1</embed></OBJECT>")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 re.Pattern="[FLASH=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "FLASH=$1,$2" & chr(2))
  re.Pattern="[/FLASH]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/FLASH" & chr(2))
 
    re.Pattern="x01FLASH=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/FLASHx02"
    strContent=re.Replace(strContent,"<a href=""$3"" TARGET=_blank><IMG SRC=http://www.chinahtml.com/images/pic/music.gif border=0 alt=点击开新窗口欣赏该FLASH动画! height=16 width=16>[全屏欣赏]</a><br><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=$1 height=$2><PARAM NAME=movie VALUE=""$3""><PARAM NAME=quality VALUE=high><embed src=""$3"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=$1 height=$2>$3</embed></OBJECT>")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_FLASH=strContent
end function

function UBB_SOUND(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[SOUND]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "SOUND" & chr(2))
  re.Pattern="[/SOUND]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/SOUND" & chr(2))
  
    re.Pattern="x01SOUNDx02(.[^x01]*)x01/SOUNDx02"
    strContent=re.Replace(strContent,"<a href=""$1"" target=_blank><IMG SRC=http://www.chinahtml.com/images/pic/music.gif border=0 alt='背景音乐'></a><bgsound src=""$1"" loop=""-1"">")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_SOUND=strContent
end function

function UBB_URL(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="<a href=""
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "URL" & chr(2))
  re.Pattern="" target=_blank>"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "URL" & chr(2))
  re.Pattern="</a>"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/URL" & chr(2))
   re.Pattern="x01URLx02(.[^x01]*)x01/URLx02"
   strContent=re.Replace(strContent,"<A HREF=""$1"" TARGET=_blank>$1</A>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 re.Pattern="*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "URL=$1" & chr(2))
  re.Pattern=""
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/URL" & chr(2))
   re.Pattern="x01URL=(.[^x01]*)x02(.[^x01]*)x01/URLx02"
   strContent=re.Replace(strContent,"<A HREF=""$1"" TARGET=_blank>$2</A>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_URL=strContent
end function

function UBB_EMAIL(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="<a href="mailto:"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "EMAIL" & chr(2))
  re.Pattern="">"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "EMAIL" & chr(2))
  re.Pattern="</a>"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/EMAIL" & chr(2))
   re.Pattern="x01EMAILx02(S+@.[^x01]*)x01/EMAILx02"
   strContent=re.Replace(strContent,"<img align=absmiddle src=http://www.chinahtml.com/images/pic/coffee.gif><A HREF=""$1