Ho una stringa di questo tipo
"1,0,1,0,0,1,0,1,0,1"
Con questa funzione cerco le terne composte da 1,0,1:
Rispetto alla stringa passata, questa funzione recupera le terne 1,0,1 indicate in verde ma non la terza in rosso nella quale il primo 1 sarebbe l'ultimo della terna precedente.codice:Function RegExResults(strTarget, strPattern) Set regEx = New RegExp regEx.Pattern = strPattern regEx.Global = true Set RegExResults = regEx.Execute(strTarget) Set regEx = Nothing End Function Set arrResults = RegExResults(testo, "1,0,1") 'In your pattern the answer is the first group, so all you need is' sResult = "" For each result in arrResults if sResult = "" then sResult = result.Submatches(0) &","& result.Submatches(1) &","& result.Submatches(2) else sResult = sResult &","& result.Submatches(0) &","& result.Submatches(1) &","& result.Submatches(2) end if Next Set arrResults = Nothing
Come procedere per far recuperare tutte le terne anche sovrapposte?
Roby

Rispondi quotando

