Our blog

您所在的位置:首页 -> 常见问题

ASP从HTML中只取出文字的代码

Function ClearHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
Set Matches = objRegExp.Execute(strHTML)
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
ClearHTML=strHTML
Set objRegExp = Nothing
End Function
'Response.write ClearHTML(rsmm("Content"))
nr=ClearHTML(rsmm("Content"))
Response.write(left(nr,80))