日期:2014-05-17  浏览次数:20873 次

在线急等,正则高手来帮个忙啊
<IMG   id=picid   alt=主题:台球少女无心打球羞涩脱衣   src= " "/UpLoadFile/2007/7/9/200779103146219.jpg " "   onload= " "var   image=new   Image();image.src=this.src;if(image.width> 0   &amp;&amp;   image.height> 0){&#13;&#10;&#9;&#9;&#9;&#9;     if(image.width> =520){this.width=520;this.height=image.height*520/image.width;}} " "   border=0   name=MMS>

怎么把   onload后的这些代码都替换去掉??

------解决方案--------------------
<%
s= " <IMG id=picid alt=主题:台球少女无心打球羞涩脱衣 src= " "/UpLoadFile/2007/7/9/200779103146219.jpg " " onload= " "var image=new Image();image.src=this.src;if(image.width> 0 &amp;&amp; image.height> 0){&#13;&#10;&#9;&#9;&#9;&#9; if(image.width> =520){this.width=520;this.height=image.height*520/image.width;}} " " border=0 name=MMS> "
Set regEx = New RegExp
regEx.Pattern = "onload= " "[\s\S]+? " " "
regEx.IgnoreCase = True
regEx.Global = True
s = regEx.Replace(s, " ")
response.write Server.HTMLEncode(s)
%>
------解决方案--------------------
Set regEx = New RegExp
regEx.Pattern = "onload?\=?.+ " "? " " "
regEx.IgnoreCase = True
regEx.Global = True

tmpStr=regEx.Replace(tmpStr, " ")
Set regEx = Nothing
Response.Write tmpStr