大家逛论坛久了就知道UBB代码了,将UBB代码转换成
HTML 代码的话,你可以使用下面的转换函数,这主要是方便使用UBB编辑器作为网站编辑器的朋友,同时也可以
学习 一下强大的正则表达式替换功能。
<%
Public Function Ubbcode(strcontent)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
'strcontent=Replace(strcontent,"file:","file :")
'strcontent=Replace(strcontent,"files:","files :")
'strcontent=Replace(strcontent,"script:","script :")
'strcontent=Replace(strcontent,"js:","js :")
'图片UBB
re.pattern="\[img\](http|https|ftp):\/\/(.[^\[]*)\[\/img\]"
strcontent=re.replace(strcontent,"
screen.width-333)this.width=screen.width-333"">")
'链接UBB
re.pattern="(\[url\])(.[^\[]*)(\[url\])"
strcontent= re.replace(strcontent,"
$2 ")
re.pattern="\[url=(.[^\[]*)\]"
strcontent= re.replace(strcontent,"
") '邮箱UBB re.pattern="(\[email\])(.*?)(\[\/email\])" strcontent= re.replace(strcontent," $2 ")
re.pattern="\[email=(.[^\[]*)\]"
strcontent= re.replace(strcontent,"
") 'QQ号码UBB re.pattern="\[qq=([1-9]*)\]([1-9]*)\[\/qq\]" strcontent= re.replace(strcontent," ")
'颜色UBB
re.pattern="\[color=(.[^\[]*)\]"
strcontent=re.replace(strcontent,"
") '文字字体UBB re.pattern="\[font=(.[^\[]*)\]" strcontent=re.replace(strcontent,"") '文字大小UBB re.pattern="\[size=([1-7])\]" strcontent=re.replace(strcontent,"") '文字对齐方式UBB re.pattern="\[align=(center|left|right)\]" strcontent=re.replace(strcontent,"")
'表格UBB
re.pattern="\[table=(.[^\[]*)\]"
strcontent=re.replace(strcontent,"
") 'FLASH动画UBB re.pattern="(\[flash\])(.[^\[]*(.swf))(\[\/flash\])" strcontent= re.replace(strcontent," [全屏欣赏]
prod_version=shockwaveflash"" type=""application/x-shockwave-flash"" width=""300"" height=""200"">$2 ") re.pattern="(\[flash=*([0-9]*),*([0-9]*)\])(.[^\[]*(.swf))(\[\/flash\])" strcontent= re.replace(strcontent," [全屏欣赏]
$4 ") 'MEDIA PLAY播放UBB re.pattern="\[wmv\](.[^\[]*)\[\/wmv]" strcontent=re.replace(strcontent," ") re.pattern="\[wmv=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/wmv]" strcontent=re.replace(strcontent," ") 'REALPLAY 播放UBB re.pattern="\[rm\](.[^\[]*)\[\/rm]" strcontent=re.replace(strcontent," ") re.pattern="\[rm=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/rm]" strcontent=re.replace(strcontent," lue=""imagewindow""> ") strcontent=replace(strcontent,vbcrlf," ") re.pattern="\[code\]((.|\n)*?)\[\/code\]" Set tempcodes=re.Execute(strcontent) For i=0 To tempcodes.count-1 re.pattern=" " tempcode=Replace(tempcodes(i)," ",vbcrlf) strcontent=replace(strcontent,tempcodes(i),tempcode) next searcharray=Array("[/url]","[/email]","[/color]", "[/size]", "[/font]", "[/align]", "[b]", "[/b]","[i]", "[/i]", "[u]", "[/u]", "[list]", "[list=1]", "[list=a]","[list=A]", "[*]", "[/list]", "[indent]", "[/indent]","[code]","[/code]","[quote]","[/quote]","[table]","[tr]","[td]","[/tr]","[/td]","[/table]") replacearray=Array("","","", "", "", "
"
相关文章
最新文件
关于网学 |
万能工具 |
在线交流 |
会员中心 |
查询论文 |
招聘说明 |
精品资源 |
专题论文 |
会员中心 |
联系方式 |
下载目录
论文目录
Copyright 2005-2018 www.myeducs.cn All Rights Reserved 版权所有·网学网 提供大量原创论文 参考论文 论文资料 源代码 管理及投稿 E_mail:3710167@qq.com
郑重声明: 本网站论文均来自互联网,由本站会员上传或下载,仅供个人交流、学习、参考之用,版权归原作者所有
请下载完后24小时之内删除,任何人不得大幅抄录、在期刊上发表或作为商业之用。如涉及版权纠纷,本网站不承担任何法律及连带责任。