内容显示页
 
类别:ASP+VBS | 浏览(352) | 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
 
 
相关链接
 
网友评论:
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片 看不清? 换张图试试
 
     
 
 
文章分类
 
 
.Net + C#(59)
 
 
ASP+VBS(161)
 
 
 
Linux(10)
 
 
 
web 2.0(25)
 
 
 
 
 
心程(68)
 
生活(95)
 
 
     

Power by :柳永法(yongfa365)'Blog  | 京ICP备07011491号  QQ:64049027  E-mail:64049027@qq.com yongfa365'CodePlex yongfa365'CodeGoogle

申请友情链接 要求:跟本站主题相类似正规网站,双方交换为首页位置

转载请注明来源,以便后人及时得到最新、修正、加强版!!!