建站常识

过滤所有HTML代码 和空格换行正则表达式

发布时间 | 2017/7/21  点击 | 

Function RemoveHTML(strHTML)

Dim objRegExp, Match, Matches

Set objRegExp = New Regexp

objRegExp.IgnoreCase = True

objRegExp.Global = True

objRegExp.Pattern = "<.+?>"

'objRegExp.Pattern = "(\r|\n|\r\n| |\t| )"

Set Matches = objRegExp.Execute(strHTML)

For Each Match in Matches

strHtml=Replace(strHTML,Match.Value,"")

Next

objRegExp.Pattern = "(\r|\n|\r\n| |\t| )"

Set Matches = objRegExp.Execute(strHTML)

For Each Match in Matches

strHtml=Replace(strHTML,Match.Value,"")

Next

RemoveHTML=strHTML

Set objRegExp = Nothing

End Function

相关信息