唐山的骨质瓷:ubb代码怎么编写呢?

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 21:11:53
求ubb代码
要求全,必须有常用的img,flash,rm,mp3,hr,b,i,等标签

贴出代码来,15分

function replaceUBB(pat,str,restr)
set regEx=new regExp
regEx.pattern=pat
regEx.IgnoreCase = true'不区分大小写
regEx.Global=True'整个字符串匹配
replaceUBB=regEx.Replace(str,restr)
set regEx=nothing
end function

function strtoUBB(str)
str=replaceUBB("\[b\](.+?)\[\/b\]",str,"<b>$1</b>")
str=replaceUBB("\[color=(.+?)\](.+?)\[\/color\]",str,"<font color=""$1"">$2</font>")
str=replaceUBB("\[center\](.+?)\[\/center\]",str,"<center>$1</center>")
str=replaceUBB("\[url\](.+?)\[\/url\]",str,"<a href=""$1"">$1</a>")
str=replaceUBB("\[url=(\S+?)\](.+?)\[\/url\]",str,"<a href=""$1"">$2</a>")
strtoUBB=str
end function

部分(url b center color)
剩下的自己补,不能太懒了