内容显示页
 
类别:ASP+VBS | 浏览(149) | 2006-7-18 13:51:00 | 关闭广告

原创:柳永法(yongfa365)'Blog

'名称:BBS过滤
'调用:guolv(str)
'参数:str为要过滤的内容;
'作用:删除一些为了推广自己公司在论坛里发布的大量的网址信息,过滤原则是去掉网址及前10个字符,
'          把一些不健康的字符替换成*


Function guolv(Words)
Words=Replace(Words,"http://web.cbdcn.com","")
OutStr=""
Dim strPattern
strPattern1 = "(.gov|.cn|.sh|.name|.ws|.ac|.io|.com|.tw|.idv|.com.cn|.org|.edu)"
strPattern2 = "(\w{0,10}(.gov|.cn|.sh|.name|.ws|.ac|.io|.com|.tw|.idv|.com.cn|.org|.edu))\b"
Dim oRegEx,oMatch
Set oRegEx = New RegExp
oRegEx.IgnoreCase = True
oRegEx.Global = True
oRegEx.Pattern = strPattern1
Words= oRegEx.Replace(Words, "$1"&VbCrLf)
oRegEx.Pattern = strPattern2
guolv = oRegEx.Replace(Words, OutStr)
Set oRegEx = Nothing

Const InvaildWords="Fuck|日你|操你"'需要过滤得字符以“|”隔开
InvaildWord=Split(InvaildWords,"|")
For each abc in InvaildWord
guolv=replace(guolv,abc,"*")
next
End Function


引用本页地址:http://www.yongfa365.com/item/f298ef488e3fca90.html
 
 
相关链接
 
网友评论:
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片看不清? 换张图试试
 
   
 
 
文章分类
 
   

Power by :柳永法(yongfa365)'Blog | Model by :hibaidu | CSS by:众网友 | 京ICP备07011491号  QQ:64049027  E-mail:64049027qq.com

本空间赞助商:北京中科兴联信息技术有限公司