asp中正则表达式中错在哪里?很及!
程序代码:
<% Function ReThestr(face,str) dim re,str re="\>" str=checkexp(re,str,">") re="\<" str=checkexp(re,str,"<") re="\n\r\n/" str=checkexp(re,str,"<P>") re=chr(32) str=checkexp(re,str," ") re="\r" str=checkexp(re,str," ") re="\[img\]((http:(\/\/|\\\\)){1}((\w)+[.]){1,3}(net|com|cn|org|cc|tv)(((\/[\~]*|\\[\~]*) (\w)+)|[.](\w)+)*(\w)+[.]{1}(gif|jpg|png))\[\/img\]" ''查找图片地址 str=checkexp(re,str," <img src=''$1''> ") re="\[w\](http:(\/\/|\\\\)((\w)+[.]){1,}(net|com|cn|org|cc|tv)(((\/[\~]*|\\[\~]*)(\w)+)|[.](\w)+)* (((([?](\w)+){1}[=]*))*((\w)+){1}([\&](\w)+[\=](\w)+)*)*)\[\/w\]" ''查找帧地址 str=checkexp(re,str,"<iframe width=''300'' height=''300'' src=''$1''></iframe>") re="([^(''>)])(<br>)*((http|https|ftp):(\/\/|\\\\)((\w)+[.]){1,}(net|com|cn|org|cc|tv|([0-9]{1,3}))(((\/[\~]*|\\[\~]*)(\w)+)|[.](\w)+)*(((([?](\w)+){1}[=]*))*((\w)+){1}([\&] (\w)+[\=](\w)+)*)*)" ''查找链接地址 str=checkexp(re,str,"$1$2 <a href=''$3'' target=_blank>$3</a> ") re="([^(http://|http:\\)])((www|cn)[.](\w)+[.]{1,}(net|com|cn|org|cc)(((\/[\~]*|\\[\~]*)(\w)+)|[.](\w)+)* (((([?](\w)+){1}[=]*))*((\w)+){1}([\&](\w)+[\=](\w)+)*)*)" ''查找不以http://开头的地址 str=checkexp(re,str,"$1 <a href=''http://$2'' target=_blank>$2</a> ") re="([^(=)])((\w)+[@]{1}((\w)+[.]){1,3}(\w)+)" ''查找邮件地址 str=checkexp(re,str," <a href=''mailto:$2''>$2</a> ") re="\[0-F])\]((.)+)\[\/color\]" ''替换字体色彩 str=checkexp(re,str,"<font color=''$1''>$4</font>") re="\{1})\]((.)+)\[\/size\]" ''替换字体大小 str=checkexp(re,str,"<font size=''$1''>$2</font>") re="\((.)+)\[\/font\]" ''替换字体 str=checkexp(re,str,"<font face=''$1''>$3</font>") re="(\[b\])(.+)(\[\/b\])" ''加粗字体 str=checkexp(re,str,"<b>$2</b>") re="(\[u\])(.+)(\[\/u\])" ''下画线 str=checkexp(re,str,"<u>$2</u>") re="(\[li\])(.+)(\[\/li\])" ''列表 str=checkexp(re,str,"<li>$2</li>") re="(\[QUOTE\])(.+)(\[\/QUOTE\])" ''引用 str=checkexp(re,str,"<BLOCKQUOTE>引用:<HR SIZE=1>$2<HR SIZE=1></BLOCKQUOTE>") re="\){1,3}(\w)+)\](.+)(\[\/email\])" ''邮件 str=checkexp(re,str,"<a href=mailto:$1>$6</a>") re="(\[center\])(.+)(\[\/center\])" ''居中 str=checkexp(re,str,"<center>$2</center>") re="fuck" str=checkexp(re,str,"***") re="操" str=checkexp(re,str,"***") re="sex" str=checkexp(re,str,"***") re="TMD" str=checkexp(re,str,"***") re="shit" str=checkexp(re,str,"***") ReThestr=str end function Function CheckExp(patrn,strng,tagstr) Dim regEx,Matches Set regEx=New RegExp''建立一个新对像 regEx.Pattern=patrn''设置模板 regEx.IgnoreCase=true''搜索是否区分大小写的 true表是不区分 flase表示区分 regEx.Global=True''搜索是否应用于整个字符串 Matches=regEx.replace(strng,tagstr)''匹配并替代字符串 CheckExp=Matches返回函数结果 end function text="大家好,欢迎来我的网站! www.(text) response.write text %>