http://tieba.baidu.com/f?kz=184238789我想采集这样一个单页面的email地址 请问VB用什么代码?谢谢!正则表达式我查到了,但是我不懂怎么用!
VB代码Function RegExpTest(patrn, strng) 'patrn:需要查找的字符 strng:被查找的字符串
  Dim regEx, Match, Matches     ' 创建变量。
  Set regEx = New RegExp            ' 创建正则表达式。
  regEx.Pattern = patrn         ' 设置模式。'"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"'
  regEx.IgnoreCase = True           ' 设置是否区分大小写。
  regEx.Global = True           ' 设置全程匹配。
  Set Matches = regEx.Execute(strng)    ' 执行搜索。
  For Each Match In Matches     ' 循环遍历Matches集合。
    RetStr = RetStr & Match.Value & "|"
  Next
  RegExpTest = RetStr
End Function'函数返回所有的查找的内容,以“|”号隔开,用户只需使用split将其转化为数组即可使用    URLRegExp = "http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?" 'URL正则表达式
    MailRegExp = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" '电子邮件正则表达式

解决方案 »

  1.   

    '引用的是microsoft   vbscript   regular   expression   5.5
    Function RegExpTest(patrn, strng)  'patrn:需要查找的字符 strng:被查找的字符串
      Dim regEx, Match, Matches     ' 创建变量。
      Set regEx = New RegExp            ' 创建正则表达式。
      regEx.Pattern = patrn         ' 设置模式。'"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"'
      regEx.IgnoreCase = True           ' 设置是否区分大小写。
      regEx.Global = True           ' 设置全程匹配。
      Set Matches = regEx.Execute(strng)    ' 执行搜索。
      For Each Match In Matches     ' 循环遍历Matches集合。
        RetStr = RetStr & Match.Value & vbCrLf
      Next
      RegExpTest = RetStr
    End Function
    Private Sub Command1_Click()
    Dim URLRegExp As String, MailRegExp As String, ChiniRegExp As String
    Dim FileName As String, sFile As String, MuName As String, Chans As String
    Dim i As Long, arr() As String, arr1() As String, arr2() As String    URLRegExp = "http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?" 'URL正则表达式
        MailRegExp = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" '电子邮件正则表达式
        ChiniRegExp = "[^\x00-\xff]* "    Open "c:\temp.html" For Binary As #1   '你的网页源码
         sFile = Space(LOF(1))
         Get #1, , sFile
              Close #1
    Text1.Text = RegExpTest(MailRegExp, sFile)
    End Sub