一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

UBB代码~(整理)

时间:2008-01-12 编辑:简简单单 来源:一聚教程网

在论坛中,我常常要使用到特殊的显示效果,而要得到这些效果,我们通常都是使用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,"$2")
RegExp.Pattern = "([URL])(HTTP://.[^[]*)([/URL])"
strNewValue = RegExp.Replace(strValue,"$2")
RegExp.Pattern = "([URL=(HTTP://.[^[]*)])(.[^[]*)([/URL])"
strNewValue = RegExp.Replace(strValue,"$3")
RegExp.Pattern = "([URL=(.[^[]*)])(.[^[]*)([/URL])"
strNewValue = RegExp.Replace(strValue,"$3")
RegExp.Pattern = "([IMG])(.[^[]*)([/IMG])"
strNewValue = RegExp.Replace(strNewValue," RegExp.Pattern = "([IMG=(HTTP://.[^[]*)])([/IMG])"
strNewValue = RegExp.Replace(strNewValue,"")
RegExp.Pattern = "([IMG=(HTTP://.[^[]*)])([/IMG])"
strNewValue = RegExp.Replace(strNewValue,"")
RegExp.Pattern = "([IMG=(.[^[]*)])([/IMG])"
strNewValue = RegExp.Replace(strNewValue,"")
RegExp.Pattern = "([SIZE=([0-9]*)])(.[^[]*)([/SIZE])"
strNewValue = RegExp.Replace(strNewValue,"$3")

热门栏目