巧用asp語言過濾html元素

字號:


    巧用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