Option Explicit
Function stripHTML(strHTML)
'Strips the HTML tags from strHTML
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.>"
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = Replace(strOutput, "strOutput = Replace(strOutput, ">", ">")
stripHTML = strOutput 'Return the value of strOutput
Set objRegExp = Nothing
End Function
%>
Enter an HTML String:
0 then %>
View of string with no HTML stripping:
View of string with HTML stripping:
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10294527/viewspace-124539/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10294527/viewspace-124539/
博客展示了一段VBScript代码,定义了一个名为stripHTML的函数,用于去除字符串中的HTML标签。通过正则表达式匹配HTML标签并替换为空字符串,还对特殊字符进行了处理,最后返回去除标签后的字符串。
587

被折叠的 条评论
为什么被折叠?



