Ciao a tutti,
sto cercando di estrarre dei campi da una stringa ma ho dei problemi con le regex.
La stringa con cui sto facendo le prove è:

"Questa è una prova <code/> e anche <name/> oppure <batch/>"

Da questa stringa, tramite regex, sto cercando di estrarre tutti i campi delimitati da < e />,
ho fatto diverse prove ma riesco a prendere sempre e solo l'ultima occorenza (batch) ma non le altre due.... (non è detto che i campi tra parentesi angolari siano solo quei tre)

Il mio codice è:

//--initialization Area
objRegExPattern = Pattern.compile("<(\\w+)/>");

Matcher objMatcher = objRegExPattern.matcher( p_strPatern );

while (objMatcher.find()) {
// Get the matching string
match = objMatcher.group( 1 );
System.out.print(match);
}


Avete un'idea in merito?



Ciao a tutti e grazie

Alessandro