Private Sub Command1_Click()
RegExpTest "123", "99912344"
End Sub

Function RegExpTest(patrn, strng)
Set regEx = CreateObject("VBScript.RegExp")      '     &&建立正则表达式对象
regEx.Pattern = patrn                '                                 &&设置模式
regEx.IgnoreCase = True       '                                        &&设置是否区分字符大小写
regEx.Global = True       '                                                &&设置全局可用性
Set matches = regEx.Execute(strng)        '                     &&执行搜索
RetStr = ""
For Each match In matches               '                        &&遍历匹配集合
    RetStr = RetStr + "找到位置:   " + LTrim(Str(match.FirstIndex)) + "," & vbCrLf
    RetStr = RetStr + "长度为   " + LTrim(Str(match.Length)) + "," & vbCrLf
    RetStr = RetStr + "找到结果为   " + match.Value + "." + Chr(10) + Chr(13) & vbCrLf
Next
MsgBox RetStr
End Function