我在VBA(WORD)中的正则表达式匹配只给出了一个结果。
我创建了这个功能
Function RE6(strData As String) As String
Dim RE As Object, REMatches As Object
Set RE = CreateObject("vbscript.regexp")
With RE
.MultiLine = False
.Global = False
.IgnoreCase = True
.Pattern = "\[substep [a-zA-Z]\](.*?); {1}"
End With
Set REMatches = RE.Execute(strData)
RE6 = ""
End Function
这里的问题是它只给出了第一个结果。例如,我有一个字符串:
[step 1] title for substeps; [substep a] step a; [substep b] step b; [substep c] step c;
我的结果是:
[substep a]步骤a;
只有1个匹配,而不是步骤b和c。