asp过滤电话、手机、qq号码函数 - TOMMYHU - 专注互联网开发及运营技术,提供相关资料及软件下载,奇趣网络时事评论!
Apr 27

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

tommyhu , 10:48 , ASP , Comments(0) , Trackbacks(0) , Reads(12948) , Via Original Large | Medium | Small
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


▲返回顶部
Last modified by tommyhu on2010/04/27 10:52

Add a comment

Nickname

emotemotemotemotemotemotemotemotemotemotemotemotemotemotemotemot