7,763
社区成员
发帖
与我相关
我的任务
分享
'此代码由“正则测试工具 v1.1.35”自动生成,请直接调用TestReg过程
Private Sub TestReg()
Dim strData As String
Dim reg As Object
Dim matchs As Object, match As Object
strData = "Public Function Showit(ByVal tt As string)" & vbCrLf & _
"msgbox tt" & vbCrLf & _
"End Function" & vbCrLf & _
"Public Function Setit(ByVal tt2 As string)" & vbCrLf & _
"text1.text=tt2" & vbCrLf & _
"End Function"
Set reg = CreateObject("vbscript.regExp")
reg.Global = True
reg.IgnoreCase = True
reg.MultiLine = True
reg.Pattern = "Function (.*?)\(ByVal"
Set matchs = reg.Execute(strData)
For Each match In matchs
'Debug.Print match.Value
Debug.Print match.SubMatches(0)
Next
End Sub