用asp怎么实现从数据库读取一段文字并把中间的一部分在<img></img>的数据剔出

来源:百度知道 编辑:UC知道 时间:2024/05/04 23:52:20
用asp怎么实现从数据库读取一段文字并把中间的一部分在<img></img>的数据剔出
谢谢,请详细一点好么?

用正则表达式

<%Public Function RemoveHTML(strText)
Dim RegEx

Set RegEx = New RegExp

RegEx.Pattern = "<img>\w+</img>"
RegEx.Global = True

RemoveHTML = RegEx.Replace(strText, "")
End Function

response.Write(RemoveHTML("aaaaaaaa<img>ccccccccc</img>bbbbbbbbbbbbbb"))%>