使用指南

asp利用正则去掉字符串中所有html内容

利用正则表达式去掉字符串中所有html内容,得到所有文本内容,去掉的内容有:div,img,超连接,script脚本等html内容。将以下例子保存为asp文件,运行一下就知道效果了。<%Function RemoveHTML( strText )Dim RegExS

2026-07-30 · 3 次阅读

利用正则表达式去掉字符串中所有html内容,得到所有文本内容,去掉的内容有:div,img,超连接,script脚本等html内容。将以下例子保存为asp文件,运行一下就知道效果了。


<%
Function RemoveHTML( strText )
Dim RegEx

Set RegEx = New RegExp

RegEx.Pattern = &<[^>]*>&
RegEx.Global = True

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

str=&打开aaa
&
response.write removehtml(str)
%>

关键词标签:内容,所有,字符串,利用

YOU MAY ALSO LIKE

更多应用推荐

浏览应用库