ASP正则表达式过滤html函数


ASP #正则 #函数2012-05-08 11:43
01<%
02Option Explicit
03Function stripHTML(strHTML)
04'Strips the HTML tags from strHTML
05Dim objRegExp, strOutput
06Set objRegExp = New Regexp
07objRegExp.IgnoreCase = True
08objRegExp.Global = True
09objRegExp.Pattern = "<.+?>"
10'Replace all HTML tag matches with the empty string
11strOutput = objRegExp.Replace(strHTML, "")
12'Replace all < and > with < and >
13strOutput = Replace(strOutput, "<", "<")
14strOutput = Replace(strOutput, ">", ">")
15stripHTML = strOutput 'Return the value of strOutput
16Set objRegExp = Nothing
17End Function
18%>

相关文章

粤ICP备11097351号-1