简单过滤一下广告的代码
程序员文章站
2022-05-18 12:52:28
好些人跟我要这段东西,其实是个很简单的代码,下边就是,自己拿去改成函数调用就可dim stra,strb,isokstra = "test,y...
好些人跟我要这段东西,其实是个很简单的代码,下边就是,自己拿去改成函数调用就可
dim stra,strb,isok
stra = "test,you,fuck,money" '需要过滤的关键字内容
strb = "fasfaefwtestfajkewhfwituckjfksajfheyou" '待检查的内容
isok = false '判断是否含有待过滤内容,如果返回true即为含有,false就是没有
dim regexp
set regexp=new regexp
regexp.ignorecase =false
regexp.global=true
dim i,j
j = ubound(split(stra,","))
for i=0 to j
regexp.pattern="("&split(stra,",")(i)&")"
if(regexp.test(strb))then
isok=true
exit for
end if
next
set regexp=nothing
response.write(isok)
dim stra,strb,isok
stra = "test,you,fuck,money" '需要过滤的关键字内容
strb = "fasfaefwtestfajkewhfwituckjfksajfheyou" '待检查的内容
isok = false '判断是否含有待过滤内容,如果返回true即为含有,false就是没有
dim regexp
set regexp=new regexp
regexp.ignorecase =false
regexp.global=true
dim i,j
j = ubound(split(stra,","))
for i=0 to j
regexp.pattern="("&split(stra,",")(i)&")"
if(regexp.test(strb))then
isok=true
exit for
end if
next
set regexp=nothing
response.write(isok)