当前位置: 移动技术网 > IT编程>开发语言>Asp > ScriptHtml 函数之过滤html标记的asp代码

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

2017年12月12日  | 移动技术网IT编程  | 我要评论
'==================================================
'函数名: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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网