用asp实现将html格式转化成纯文本

2024-12-12 12:29:30
推荐回答(1个)
回答1:

正则表达式过滤
Function filtscript(strHTML)
Dim objRegExp, strOutput
Set objRegExp = New Regexp
strOutput=strHTML
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<[^>]*>"
strOutput = objRegExp.Replace(strOutput, "")
objRegExp.Pattern = "<\/[^>]*>"
strOutput = objRegExp.Replace(strOutput, "")
strOutput = replace(strOutput, "javascript:", "javascript :")
filtscript = strOutput
Set objRegExp = Nothing
End Function