比如这样
1<content>这里有个[input][/input]<content>
2
3从xml转换到html的过程中,需要将input框转化出来,应该怎么处理这里的代码
4
5BTW:用translate()函数可以单个转,但是如果这里有多个ubb的代码需要转换呢
6\---------------------------------------------------------------
7
8转换时调用一次下面的函数
9function UBBCode(str)
10strContent=Replace(str,vbCrLf,"<br/>")
11dim objRegExp
12Set objRegExp=new RegExp
13objRegExp.IgnoreCase =true
14objRegExp.Global=True
15
16'换行
17objRegExp.Pattern="(\\[br\\])"
18strContent=objRegExp.Replace(strContent,"
19")
20'下划线
21objRegExp.Pattern="(\\[u\\])(.+?)(\\[\/u\\])"
22strContent=objRegExp.Replace(strContent,"<u>$2</u>")
23'斜体
24objRegExp.Pattern="(\\[i\\])(.+?)(\\[\/i\\])"
25strContent=objRegExp.Replace(strContent,"<i>$2</i>")
26'加粗
27objRegExp.Pattern="(\\[b\\])(.+?)(\\[\/b\\])"
28strContent=objRegExp.Replace(strContent,"<b>$2</b>")
29'双横线
30objRegExp.Pattern="(\\[QUOTE\\])(.+?)(\\[\/QUOTE\\])"
31strContent=objRegExp.Replace(strContent,"<blockquote><font arial""="" face="" size="2" verdana,="">引用:</font><hr/>$2<hr/></blockquote>")
32'红色
33objRegExp.Pattern="(\\[red\\])(.+?)(\\[\/red\\])"
34strContent=objRegExp.Replace(strContent,"<font #ff0000""="" color="">$2</font>")
35'灰色
36objRegExp.Pattern="(\\[gray\\])(.+?)(\\[\/gray\\])"
37strContent=objRegExp.Replace(strContent,"<font #77acac""="" color="">$2</font>")
38'绿色
39objRegExp.Pattern="(\\[green\\])(.+?)(\\[\/green\\])"
40strContent=objRegExp.Replace(strContent,"<font #009933""="" color="">$2</font>")
41'蓝色
42objRegExp.Pattern="(\\[blue\\])(.+?)(\\[\/blue\\])"
43strContent=objRegExp.Replace(strContent,"<font #0055ff""="" color="">$2</font>")
44'任何颜色字
45objRegExp.Pattern="(\\[color\=)(.+?)(\\])(.+?)(\\[\/color\\])"
46strContent=objRegExp.Replace(strContent,"<font $2""="" color="">$4</font>")
47'电子邮件
48objRegExp.Pattern="(\\[EMAIL\\])(\S+\@\S+?)(\\[\/EMAIL\\])"
49strContent= objRegExp.Replace(strContent,"<a href="" mailto:$2""="">$2</a>")
50'带链接的文字
51objRegExp.Pattern="(\\[URL\\])(http:\/\/\S+?)(\\[\/URL\\])"
52strContent= objRegExp.Replace(strContent,"<a $2""="" href="" target="_blank">$2</a>")
53objRegExp.Pattern="(\\[URL\\])(\S+?)(\\[\/URL\\])"
54strContent= objRegExp.Replace(strContent,"<a $2""="" href="" http:="" target="_blank">$2</a>")
55'滚动
56objRegExp.Pattern="(\\[marquee\\])(.+?)(\\[\/marquee\\])"
57strContent=objRegExp.Replace(strContent,"<marquee id="xxskybbs" onmouseout="xxskybbs.start()" onmouseover="xxskybbs.stop()" scrollamount="3">$2</marquee>")
58'回滚
59objRegExp.Pattern="(\\[marqueea\\])(.+?)(\\[\/marqueea\\])"
60strContent=objRegExp.Replace(strContent,"<marquee alternate""="" behavior="" id="xxskybbs" onmouseout="xxskybbs.start()" onmouseover="xxskybbs.stop()" scrollamount="3">$2</marquee>")
61'带链接的图片
62objRegExp.Pattern="(\\[IMGurl\=)(http:\/\/\S+?)(\\])(http:\/\/\S+?)(\\[\/IMGurl\\])"
63strContent=objRegExp.Replace(strContent,"<a $2""="" href="" target="_blank"><img $4""="" border="0" javascript:if(this.width="" onload="" src=""/>screen.width-366)this.width=screen.width-366""></a>")
64objRegExp.Pattern="(\\[IMGurl\=)(\S+?)(\\])(\S+?)(\\[\/IMGurl\\])"
65strContent=objRegExp.Replace(strContent,"<a $2""="" href="" http:="" target="_blank"><img $4""="" border="0" http:="" javascript:if(this.width="" onload="" src=""/>screen.width-366)this.width=screen.width-366""></a>")
66'图片
67objRegExp.Pattern="(\\[IMG\\])(\S+?)(\\[\/IMG\\])"
68strContent=objRegExp.Replace(strContent,"<img $2""="" src=""/>")
69
70
71set objRegExp=Nothing
72UBBCode=strContent
73end function</content></content>