解决方案 »

  1.   

    '此代码由“正则测试工具  v1.1.35”自动生成,请直接调用TestReg过程
    Private Sub TestReg()
        Dim strData As String
        Dim reg As Object
        Dim matchs As Object, match As Object    strData = "AA,BB,%CC%,DD,%EE%"    Set reg = CreateObject("vbscript.regExp")
        reg.Global = True
        reg.MultiLine = True
        reg.Pattern = "%.*?%"
        Set matchs = reg.Execute(strData)
        For Each match In matchs
            Debug.Print match.Value
        Next
    End Sub
    习惯性使用正则大法,上面为vb6的,自己改成。net的
      

  2.   

    你用 Return 语句,找到第一个 c 就直接返回了啊!代码逻辑就是只找一个啊!
    如果要找多个需要把 c 拼到一个结果变量中,继续循环;最后如果结果变量有内容就返回结果变量。