2012-09-06 18 views
5

la mia corrispondenza regolare in VBA (WORD) dà solo un risultato.vba regex restituisce solo la prima corrispondenza

ho creato questa funzione

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 

Il problema qui è che dà solo il primo risultato. Per esempio ho ricevuto una stringa:

[step 1] title for substeps; [substep a] step a; [substep b] step b; [substep c] step c; 

Il mio risultato è:

[sotto-fase a] un passo;

solo 1 corrispondenza, non il passaggio be c.

risposta

Problemi correlati