求一代UBB代码 反向的

love800309 2003-12-09 03:16:06
就是说在编辑贴子的时候
格式从数据库出来的时候
也要以  [][]  这种格式显示

我现在只有进行数据库里的UBB
麻烦高手给一段反向的
如下:

Function UBB(str)
Dim regEx
Set regEx = New RegExp

regEx.IgnoreCase = True
regEx.Global = True
'code
'url
regEx.Pattern="(\[url\])(http:\/\/\S+)(\[\/url\])"
str=regEx.Replace(str,"<a href=""$2"" target=_blank>$2</a>")
regEx.Pattern="(\[url\])(\S+)(\[\/url\])"
str=regEx.Replace(str,"<a href=""http://$2"" target=_blank>http://$2</a>")
'img
regEx.Pattern="(\[img\])(http:\/\/\S+(\.gif|\.jpg))(\[\/img\])"
str=regEx.Replace(str,"<img src=$2 >")
regEx.Pattern="(\[img\])(\S+(\.gif|\.jpg))(\[\/img\])"
str=regEx.Replace(str,"<img src=""http://\S+?(\.gif|\.jpg)"">")
'mail
regEx.Pattern="(\[email\])(\w+@[0-9a-zA-Z_\.]+\.[a-zA-Z]{2,3})(\[\/email\])"
str=regEx.Replace(str,"<a href=""mailto:$2"">$2</a>")
'sup
regEx.Pattern="(\[sup\])(\S+)(\[\/sup\])"
str=regEx.Replace(str,"<sup>$2</sup>")
'sub
regEx.Pattern="(\[sub\])(\S+)(\[\/sub\])"
str=regEx.Replace(str,"<sub>$2</sub>")
'hr
regEx.Pattern="(\[hr\])"
str=regEx.Replace(str,"<hr width=""95%"">")
'b
regEx.Pattern="(\[b\])([\S\n\r ]+)(\[\/b\])"
str=regEx.Replace(str,"<b>$2</b>")
'center
regEx.Pattern="(\[center\])([\S\n\r ]+)(\[\/center\])"
str=regEx.Replace(str,"<center>$2</center>")
'left
regEx.Pattern="(\[left\])([\S\n\r ]+)(\[\/left\])"
str=regEx.Replace(str,"<div align=left>$2</div>")
'right
regEx.Pattern="(\[right\])([\S\n\r ]+)(\[\/right\])"
str=regEx.Replace(str,"<div align=right>$2</div>")
'red
regEx.Pattern="(\[red\])([\S\n\r ]+)(\[\/red\])"
str=regEx.Replace(str,"<font color=""red"">$2</font>")
'blue
regEx.Pattern="(\[blue\])([\S\n\r ]+)(\[\/blue\])"
str=regEx.Replace(str,"<font color=""blue"">$2</font>")
'green
regEx.Pattern="(\[green\])([\S\n\r ]+)(\[\/green\])"
str=regEx.Replace(str,"<font color=""green"">$2</font>")
'#
regEx.Pattern="(\[#([0-9a-fA-F]{6,6})\])([\S\n\r ]+)(\[\/#\])"
str=regEx.Replace(str,"<font color=""#$2"">$3</font>")
Set regEx=nothing
UBB=str
End Function
...全文
39 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
cloudchen 2003-12-10
  • 打赏
  • 举报
回复
保存到数据库的为没有被Ubb转换过的代码,就像这样hello,world!

在显示给用户看的时候一般都是rs("content"),这样看到的就是hello,world!,再加个Ubb(rs("content")),这样每次刷新都要转换一次ubb,不过这样编辑的时候就不会有问题了。
love800309 2003-12-09
  • 打赏
  • 举报
回复
TO:陈系上

你给我的链接上说 显示得时候也用UBB来显示

他的意思是说还是用这段UBB代码来显示吗?

谢谢
love800309 2003-12-09
  • 打赏
  • 举报
回复
UP
cloudchen 2003-12-09
  • 打赏
  • 举报
回复
要逆很难,一般都是在select的时候进行ubb匹配

http://www.blueidea.com/bbs/newsdetail.asp?id=1264008&posts=currentposts

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧