Function RemoveHTML(Textstr)
Dim sStr, regEx
sStr = Textstr
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Multiline = True
regEx.Pattern = "<script[\s\S]*?</script>" '屏蔽 代码类的 script
sStr = regEx.Replace(sStr, "")
regEx.Pattern = "<style[\s\S]*?</style>" '屏蔽 代码类的 style
sStr = regEx.Replace(sStr, "")
' regEx.Pattern = "style=""[\s\S]*?""" '屏蔽 代码类的 style=""
' sStr = regEx.Replace(sStr, "")
' regEx.Pattern = "class=[\s\S]*? " '屏蔽 代码类的 class=
' sStr = regEx.Replace(sStr, "")
' regEx.Pattern = "\s[on].+?=([\""|\'])(.*?)\1" '屏蔽 代码类的 html
' sStr = regEx.Replace(sStr, "")
' regEx.Pattern = "<(.[^>]*)>" '屏蔽 代码类的 html
' sStr = regEx.Replace(sStr, "")
Set regEx = Nothing
RemoveHTML = sStr
End Function
调用 RemoveHTML(str)
最新评论