国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 網(wǎng)站 > 建站經(jīng)驗(yàn) > 正文

asp !過(guò)濾html標(biāo)簽

2019-11-02 15:46:32
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

這是四款asp 過(guò)濾html標(biāo)簽函數(shù)與方法,這些大全部都是利用正則表達(dá)式來(lái)過(guò)濾以<與>的數(shù)據(jù),然后替換里面的東西,這樣asp過(guò)濾html的函數(shù)不成功了。

function htmlencode(text)
{
return text.replace(/&/g, '&amp').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}

function htmldecode(text)
{
return text.replace(/&amp;/g, '&').replace(/&quot;/g, '"').replace(/&lt;/g, '<').replace(/&gt;/g, '>');
}

方法二

function nohtml(str)
 dim re
 set re=new regexp
 re.ignorecase =true
 re.global=true
 re.pattern="<(.[^>]*)>"
 str=re.replace(str,"")
 nohtml=str
 set re=nothing
end function'過(guò)濾html標(biāo)簽方

方法三

function filterhtml(strtofilter)
     dim objregexp, match, matches
     set objregexp = new regexp
     objregexp.ignorecase = true
     objregexp.global = true 
     取閉合的<>
     objregexp.pattern = "<.+?>" 
     進(jìn)行匹配
     set ma

酷貓電影網(wǎng)[www.aikan.tv/special/kumiaodianyingwang/]
tches = objregexp.execute(strtofilter) 
     遍歷匹配集合,并替換掉匹配的項(xiàng)目
     for each match in matches
     strtofilter=replace(strtofilter,match.value,"")
     next
     filterhtml=strtofilter
     set objregexp = nothing
end function

調(diào)用

str=filterhtml(str)

過(guò)濾html標(biāo)簽方法四

function nohtml(str)
 dim re
 set re=new regexp
 re.ignorecase =true
 re.global=true
 re.pattern="(<.[^<]*>)"
 str=re.replace(str,"")
 re.pattern="(</[^<]*>)"
 str=re.replace(str,"")
 nohtml=str
 set re=nothing
end function

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 乌兰浩特市| 沅江市| 襄樊市| 凉城县| 吴川市| 菏泽市| 衡东县| 象州县| 黎川县| 洛阳市| 和林格尔县| 潮州市| 双鸭山市| 萝北县| 清河县| 临夏市| 孟津县| 夏河县| 福安市| 西藏| 梨树县| 剑河县| 新安县| 兴安县| 晋中市| 惠安县| 嘉鱼县| 谢通门县| 南汇区| 广宁县| 常德市| 芜湖县| 铜鼓县| 铁力市| 调兵山市| 宿松县| 河池市| 梨树县| 博爱县| 靖远县| 通山县|