帮忙看一下代码,是起什么作用的

fap 2006-02-03 01:40:43
<Script Language=JScript Runat=Server>
function ybbcode(temp) {
temp = temp.replace(/(\[b\])(.[^\[]*)(\[\/b\])/ig,"<b>$2<\/b>");
temp = temp.replace(/(\[i\])(.[^\[]*)(\[\/i\])/ig,"<I>$2<\/I>");
temp = temp.replace(/(\[u\])(.[^\[]*)(\[\/u\])/ig,"<u>$2<\/u>");
temp = temp.replace(/(\[strike\])(.[^\[]*)(\[\/strike\])/ig,"<strike>$2<\/strike>");
temp = temp.replace(/(\[center\])(.[^\[]*)(\[\/center\])/ig,"<center>$2<\/center>");
temp = temp.replace(/(\[marquee\])(.[^\[]*)(\[\/marquee\])/ig,"<marquee>$2<\/marquee>");
temp = temp.replace(/(\[IMG\])(http:\/\/.[^\[]*)(\[\/IMG\])/ig,"<img border=0 src=$2 onload='javascript:if(this.width>screen.width-250)this.width=screen.width-250'>");
temp = temp.replace(/(\[URL\])(http:\/\/.[^\[]*)(\[\/URL\])/ig,"<A TARGET=_blank HREF=\"$2\">$2</A>");
temp = temp.replace(/(\[URL=)(http:\/\/.[^\[]*)(\])(.[^\[]*)(\[\/URL\])/ig,"<A TARGET=_blank HREF=\"$2\">$4</A>");
temp = temp.replace(/(\[EMAIL\])(\S+\@.[^\[]*)(\[\/EMAIL\])/ig,"<a href=mailto:$2>$2</a>");
temp = temp.replace(/(\[font=)(.[^.:;`'"=]*)(\])(.[^\[]*)(\[\/font\])/ig,"<FONT face=\"$2\">$4<\/FONT>");
temp = temp.replace(/(\[size=)(.[^.:;`'"=]*)(\])(.[^\[]*)(\[\/size\])/ig,"<FONT size=\"$2\">$4<\/FONT>");
temp = temp.replace(/(\[COLOR=)(.[^.:;`'"=]*)(\])(.[^\[]*)(\[\/COLOR\])/ig,"<FONT COLOR=\"$2\">$4<\/FONT>");
temp = temp.replace(/(\[code\])(.[^\[]*)(\[\/code\])/ig,"<BLOCKQUOTE><strong>代码</strong>:<HR Size=1>$2<HR SIZE=1><\/BLOCKQUOTE>");
temp = temp.replace(/(\[QUOTE\])(.[^\[]*)(\[\/QUOTE\])/ig,"<BLOCKQUOTE><strong>引用</strong>:<HR Size=1>$2<HR SIZE=1><\/BLOCKQUOTE>");
return (temp);
}
function unybbcode(temp) {
temp = temp.replace(/<br>/ig,"\n");
temp = temp.replace(/<b>(.[^\[]*)<\/b>/ig,"\[b\]$1\[\/b\]");
temp = temp.replace(/<i>(.[^\[]*)<\/i>/ig,"\[i\]$1\[\/i\]");
temp = temp.replace(/<u>(.[^\[]*)<\/u>/ig,"\[u\]$1\[\/u\]");
temp = temp.replace(/<strike>(.[^\[]*)<\/strike>/ig,"\[strike\]$1\[\/strike\]");
temp = temp.replace(/<center>(.[^\[]*)<\/center>/ig,"\[center\]$1\[\/center\]");
temp = temp.replace(/<marquee>(.[^\[]*)<\/marquee>/ig,"\[marquee\]$1\[\/marquee\]");
temp = temp.replace(/<A TARGET=_blank HREF="(.[^\[]*)">(.[^\[]*)<\/A>/ig,"[URL=$1\]$2\[\/URL\]");
temp = temp.replace(/ onload='javascript:if(.*)this.width=screen.width-250'/ig,"");
temp = temp.replace(/<img border=0 src=(http:\/\/\S+)>/ig,"[IMG\]$1\[\/IMG\]");
temp = temp.replace(/<a href=mailto:(\w+\@\w+.[\w.]+)>(\w+\@\w+.[\w.]+)<\/a>/ig,"[EMAIL\]$1\[\/EMAIL\]");
temp = temp.replace(/<FONT face="([^.:;`'"=]+)">(.[^\[]*)<\/FONT>/ig,"[font=$1\]$2\[\/font\]");
temp = temp.replace(/<FONT size="([^.:;`'"=]+)">(.[^\[]*)<\/FONT>/ig,"[size=$1\]$2\[\/size\]");
temp = temp.replace(/<FONT COLOR="([^.:;`'"=]+)">(.[^\[]*)<\/FONT>/ig,"[COLOR=$1\]$2\[\/COLOR\]");
temp = temp.replace(/<BLOCKQUOTE><strong>引用<\/strong>:<HR Size=1>(.[^\[]*)<HR SIZE=1><\/BLOCKQUOTE>/ig,"\[QUOTE\]$1\[\/QUOTE\]");
temp = temp.replace(/<BLOCKQUOTE><strong>代码<\/strong>:<HR Size=1>(.[^\[]*)<HR SIZE=1><\/BLOCKQUOTE>/ig,"\[CODE\]$1\[\/CODE\]");
temp = temp.replace(/<BLOCKQUOTE>/ig,"\[QUOTE\]");
temp = temp.replace(/<\/BLOCKQUOTE>/ig,"\[\/QUOTE\]");
temp = temp.replace(/<(.[^\[]*)>/ig,"");
return (temp);
}
function smilies(temp) {
temp = temp.replace(/\:\)/ig,"<IMG border=0 SRC=images\/brow\/regular_smile.gif>");
temp = temp.replace(/\:d/ig,"<IMG border=0 SRC=images\/brow\/teeth_smile.gif>");
temp = temp.replace(/\:o/ig,"<IMG border=0 SRC=images\/brow\/omg_smile.gif>");
temp = temp.replace(/\:p/ig,"<IMG border=0 SRC=images\/brow\/tounge_smile.gif>");
temp = temp.replace(/\;\)/ig,"<IMG border=0 SRC=images\/brow\/wink_smile.gif>");
temp = temp.replace(/\:\(/ig,"<IMG border=0 SRC=images\/brow\/sad_smile.gif>");
temp = temp.replace(/\:s/ig,"<IMG border=0 SRC=images\/brow\/confused_smile.gif>");
temp = temp.replace(/\:\|/ig,"<IMG border=0 SRC=images\/brow\/whatchutalkingabout_smile.gif>");
temp = temp.replace(/\:\$/ig,"<IMG border=0 SRC=images\/brow\/embaressed_smile.gif>");
return (temp);
}
function delquote(temp) {
temp = temp.replace(/<BLOCKQUOTE>(.[^\[]*)<\/BLOCKQUOTE>/ig,"");
return (temp);
}
</Script>
麻烦各位大哥帮忙看一下,是起啥作用的
...全文
66 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
soft_2008 2006-02-03
  • 打赏
  • 举报
回复
怎么看起来像是入注的替换符? -_-#
king_shadow 2006-02-03
  • 打赏
  • 举报
回复
这是一段根据正则表达式实现ubb 功能的代码
如你字符中包含 则,显示出来的是粗字体的一段文字

28,406

社区成员

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

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