当前位置:首页 > ASP教程 > 应用技巧

ScriptHtml 函数之过滤html标记的asp代码

'==================================================
'函数名:scripthtml
'作  用:过滤html标记
'参  数:constr ------ 要过滤的字符串
'==================================================
function scripthtml(byval constr,tagname,ftype)
    dim re
    set re=new regexp
    re.ignorecase =true
    re.global=true
    select case ftype
    case 1
       re.pattern="<" & tagname & "([^>])*>"
       constr=re.replace(constr,"")
    case 2
       re.pattern="<" & tagname & "([^>])*>.*?</" & tagname & "([^>])*>"
       constr=re.replace(constr,"") 
    case 3
       re.pattern="<" & tagname & "([^>])*>"
       constr=re.replace(constr,"")
       re.pattern="</" & tagname & "([^>])*>"
       constr=re.replace(constr,"")
    end select
    scripthtml=constr
    set re=nothing
end function
【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!