asp截取<img>标签的问题
取一段内容,内容中有 <img> 标签,我不想取 <img> 标签,要把 <img> 标签过滤钓,怎么弄?
内容:
aaaaaaaa <IMG src= "/teching/techerphoto/20074101780203.jpg " border=0> afafasfa
------解决方案--------------------Function ScriptHtml(Byval ConStr,TagName,FType)
Dim Re
Set Re=new RegExp
Re.IgnoreCase =true
Re.Global=True
Select Case FType
Case 1
Re.Pattern= " < " & TagName & "([^> ])*> "
ConStr=Re.Replace(ConStr, " ")
Case 2
Re.Pattern= " < " & TagName & "([^> ])*> .*? </ " & TagName & "([^> ])*> "
ConStr=Re.Replace(ConStr, " ")
Case 3
Re.Pattern= " < " & TagName & "([^> ])*> "
ConStr=Re.Replace(ConStr, " ")
Re.Pattern= " </ " & TagName & "([^> ])*> "
ConStr=Re.Replace(ConStr, " ")
End Select
ScriptHtml=ConStr
Set Re=Nothing
End Function
-----------------------------------------------------
举例
Html = ScriptHtml(Html, "table ",3)
Html = ScriptHtml(Html, "tr ",3)
Html = ScriptHtml(Html, "td ",3)
Html = ScriptHtml(Html, "img ",1)
怎么用自己试一下