4月27

asp过滤电话、手机、qq号码函数

| |
10:48 ASP  From: 本站原创
asp过滤电话、手机、qq号码函数,asp正则表达式过滤字符串中的电话号码/qq等数字
用处过滤文章、留言、评论处的广告手机,电话,QQ等

Function RegExpTest(strng)  '以数组返回
    i = 0
    Set regEx = New RegExp
    regEx.Pattern = "(\d+)" '"[0-9]"
    regEx.IgnoreCase = True
    regEx.Global = True
    Set Matches = regEx.Execute(strng)
    For Each Match in Matches
        RetStr = RetStr &"<br>"& Match.Value '输出提取出来的数字
        i = i + 1
    Next
    RegExpTest = RetStr
End Function



asp正则表达式屏蔽字符串中的email地址

Function repmail(strng)  '以数组返回
    i = 0
    Set regEx = New RegExp
    regEx.Pattern = "[a-zA-Z0-9]+@([a-zA-Z0-9]+\.)+[a-zA-Z0-9]+"
    regEx.IgnoreCase = True
    regEx.Global = True
    Set Matches = regEx.Execute(strng)
    For Each Match in Matches
        'RetStr = RetStr &"<br>"& Match.Value
  If  Len(Match.Value)>=5 Then
   strng = Replace(strng, left(Match.Value,5),"***")
  End If
        i = i + 1
    Next
    repmail = strng
End Function


最后编辑: tommyhu 编辑于2010/04/27 10:52
阅读(4786) | 评论(0) | 引用(0)
在此留下酱油瓶-:)
表情
emotemotemotemotemotemotemotemotemotemotemotemotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我

您的大名(例如:小明) : 

密码(可不填) :  游客无需密码

网址 (可不填) : 

电邮 (可不填) :  [注册]