亚马逊产品描述插图:正则表达式问题ASP

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/03 04:03:02
数据库字段中有不确定的字符串,图文都有,图片文字多少不确定,图片也不是只有一张,例如:<p><img src="*****"><br>文字文字文字文字文字<img onmousewheel="return zoom_img(event,this)" alt="" src="UploadFiles/2006-7/200672975338566.jpg" onload="javascript:if(this.width>740)this.width=740><font size=2>文字文字</font></p>;
现在要去掉该字符串中的图片,保留图片以外的文字和HTML代码,请问应该如何实现?
dim constr
constr=rsad("Content")
constr= replace(replace(constr,"<IMG ",""),"border=undefined>","")
constr=replace(replace(constr,"& .lt;IMG alt=",""),"(event,this)"">","-->")
constr=replace(replace(constr,"& .lt;","<"),"& .gt;",">")
constr=replace(replace(constr,"img","!--"),"IMG","!--")
constr=replace(replace(constr,"(event,this)"">",""),"<img","<!--")
constr=replace(replace(constr,"<p></p>"," "),"<p algin=center></p>","")
response.Write aa(constr)
我的代码,太费劲了

re.Pattern ="<IMG[^>]+>"
然后替换掉就好了
注意设置成不分大小写的模式