Bonjour,
Je sais que ça peut paraître très c**. Mais j'ai un problème:
Mais ce code ne fonctionne pas toujours...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 NodeList children = el.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if(child instanceof Element){parse(child);} else if((child instanceof Text )&& (((Text) child).getData().trim().length() != 0)){ String txt = ((Text) child).getData(); pattern=Pattern.compile("Quest\s*\(\s*(\d+)\s*:\s*(\d+)\s*\)"); matcher=pattern.matcher(txt); if(matcher.matches()){ System.out.println("trouvé"); for(int q=0;q<=matcher.groupCount();q++){ System.out.println(q+"==>"+matcher.group(q)); } } System.out.println(txt); } }
Auriez-vous une idée pour améliorer cette REGEX ? ou le problème se trouve-t-il dans le code lui-même ?
Merci d'avance...
Partager