巧用asp語言過濾html元素

字號(hào):


    巧用asp語言過濾html元素:
    '過濾html
    '函數(shù)名:GlHtml
    '作 用:過濾html 元素
    '參 數(shù):str ---- 要過濾字符
    '返回值:沒有html 的字符
    '**************************************************
    Public Function GlHtml(ByVal str)
    If IsNull(str) Or Trim(str) = "" Then
    GlHtml = ""
    Exit Function
    End If
    Dim re
    Set re = New RegExp
    re.IgnoreCase = True
    re.Global = True
    re.Pattern = "(<.[^<]*>)"
    str = re.Replace(str, " ")
    re.Pattern = "(</[^<]*>)"
    str = re.Replace(str, " ")
    Set re = Nothing
    str = Replace(str, "'", "")
    str = Replace(str, Chr(34), "")
    GlHtml = str
    End Function