在论坛中,我常常要使用到特殊的显示效果,而要得到这些效果,我们通常都是使用ubb 函数来处理,下面是我整理的ubb代码~,有待完善~ [CODE] '----------------------------------------------------------' '--------------------UBBCode Function----------------------' '----------------------------------------------------------' Function UBBCode(ByVal strValue) '忽略错误 On Error Resume Next '定义变量 Dim RegExp Dim strNewValue Set RegExp = New RegExp RegExp.IgnoreCase = True RegExp.Global = True strValue = UCase(HTMLEncode(strValue)) If strValue <> "" Then RegExp.Pattern = "([URL])(.[^[]*)([/URL])" strNewValue = RegExp.Replace(strValue,"<A HREF='HTTP://$2' TARGET='_BLANK'>$2</A>") RegExp.Pattern = "([URL])(HTTP://.[^[]*)([/URL])" strNewValue = RegExp.Replace(strValue,"<A HREF='$2' TARGET='_BLANK'>$2</A>") RegExp.Pattern = "([URL=(HTTP://.[^[]*)])(.[^[]*)([/URL])" strNewValue = RegExp.Replace(strValue,"<A HREF='$2' TARGET='_BLANK'>$3</A>") RegExp.Pattern = "([URL=(.[^[]*)])(.[^[]*)([/URL])" strNewValue = RegExp.Replace(strValue,"<A HREF='HTTP://$2' TARGET='_BLANK'>$3</A>") RegExp.Pattern = "([IMG])(.[^[]*)([/IMG])" strNewValue = RegExp.Replace(strNewValue,"<IMG SRC='$2' BORDER='0'>") RegExp.Pattern = "([IMG=(HTTP://.[^[]*)])([/IMG])" strNewValue = RegExp.Replace(strNewValue,"<IMG SRC='$2' BORDER='0'>") RegExp.Pattern = "([IMG=(.[^[]*)])([/IMG])" strNewValue = RegExp.Replace(strNewValue,"<IMG SRC='HTTP://$2' BORDER='0'>") RegExp.Pattern = "([SIZE=([0-9]*)])(.[^[]*)([/SIZE])" strNewValue = RegExp.Replace(strNewValue,"<FONT SIZE='$2'>$3</FONT>") |