ASP清除HTML代码,asp格式化html标签代码

  • 文章来源:LG工作室
  • 发布时间:2018-12-27 06:02:52
  • 责任编辑:lg2lg5
导读:ASP清除HTML代码,函数名:ClearHtml,函数说明:asp格式化html标签代码函数,参数:sBody:HTML内容,返回值:去除所有HTML格式标签后的内容。
'***函数名  : ClearHtml
'***函数说明: 清除文件HTML格式函数
'***参数    : sBody   : HTML内容
'***返回值  : 去除所有HTML格式标签后的内容
Function ClearHtml(sBody)
    Dim regEx
    sBody = Replace(sBody, "<", "<")
    sBody = Replace(sBody, ">", ">")
    sBody = Replace(sBody, "&", "&")
    sBody = Replace(sBody, " ", "")
    sBody = Replace(sBody, """, "&")
    sBody = Replace(sBody, "×", "×")
    sBody = Replace(sBody, "÷", "÷")
    sBody = Replace(sBody, "    ", "")
    sBody = Replace(sBody, " ", "")
    sBody = Replace(sBody, " ", "")
    sBody = Replace(sBody, Chr(13), "")
    sBody = Replace(sBody, Chr(10), "")

    Set regEx = New RegExp
    regEx.IgnoreCase = True        '设置忽略字符大小写
    regEx.Global = True            '设置全局可用性
    regEx.Pattern = "]*?>.*?"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*?>.*?"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "on(mouse|exit|error|click|key)"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "<\\?xml[^>]*>"
    sBody = regEx.Replace(sBody, "")
    regEx.Pattern = "<\/?[a-z]+:[^>]*>"
    sBody = regEx.Replace(sBody, "")
    Set regEx = Nothing
    ClearHtml = sBody
End Function
建站套餐
联系我们
客户案例