巧用asp語(yǔ)言過(guò)濾html元素:
'過(guò)濾html
'函數(shù)名:glhtml
'作 用:過(guò)濾html 元素
'參 數(shù):str ---- 要過(guò)濾字符
'返回值:沒(méi)有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
更多信息請(qǐng)查看IT技術(shù)專(zhuān)欄