读书人

在线急等正则高手来帮个忙啊该怎么解

发布时间: 2012-02-29 16:44:10 作者: rapoo

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

读书人网 >ASP

热点推荐