Bonjour a tous,
J'ai écrit la regexp suivante = ^%%(.+=.+/)+#.*%%$
Ma chaine a analyser et la suivante : %%DA=toto/DU=TUTU/FE=coucou/#vide%%

Ma méthode contient le code suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
		String regexp = "^%%(.+=.+/)+#.*%%$"
		// Compile and use regular expression
		Matcher matcher = Pattern.compile(regexp).matcher(s);
 
		if (matcher.find()) {
			// Get all groups for this match
			for (int i = 1; i <= matcher.groupCount(); i++) {
				String groupStr = matcher.group(i);
				System.out.println("\t" + i + "=>" + groupStr);
			}
		}
Le problème c'est qu'au lieu de me capturer :
  • DA=toto/
  • DU=TUTU/
  • FE=coucou/

Il me capture DA=toto/DU=TUTU/FE=coucou/

Auriez vous une idée?

Merci d'avance