名称: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/
CIO之家 www.ciozj.com 微信公众号:imciow