這是四款asp 過濾html標簽函數與方法
function htmlencode(text)
{
return text
}
function htmldecode(text)
{
return text
}
方法二
function nohtml(str)
dim re
set re=new regexp
re
re
re
str=re
nohtml=str
set re=nothing
end function
方法三
function filterhtml(strtofilter)
dim objregexp
set objregexp = new regexp
objregexp
objregexp
取閉合的<>
objregexp
進行匹配
set matches = objregexp
遍歷匹配集合
for each match in matches
strtofilter=replace(strtofilter
next
filterhtml=strtofilter
set objregexp = nothing
end function
調用
str=filterhtml(str)
過濾html標簽方法四
function nohtml(str)
dim re
set re=new regexp
re
re
re
str=re
re
str=re
nohtml=str
set re=nothing
end function
From:http://tw.wingwit.com/Article/program/net/201311/14218.html