Utilisation de Regex

Fermé
jouben Messages postés 1 Date d'inscription vendredi 18 décembre 2009 Statut Membre Dernière intervention 18 décembre 2009 - 18 déc. 2009 à 14:02
Bonjour,

Comment ecrire un pattern.compile permettant de tester les caractéres ASCII x00 à x20 afin de les transformer en espace.

J'ai codé :

import java.util.regex.* ;

public class TestNouveauté {

private static Pattern pattern ;
private static Matcher matcher ;

public static void main(final String[] args) throws IOException, PatternSyntaxException {

boolean top = true
pattern = Pattern.compile("\\x00-\\xFF") ;
matcher = pattern.matcher(resul) ;
System.out.println(resul) ;
while (matcher.find()) {
System.out.println(matcher.group() + " - Debut : " + matcher.start() + " Fin : " + matcher.end()) ;
top = true ;
}
resul = matcher.replaceAll(" ") ;
System.out.println(resul) ;
}

Bien que mon source "resul" contienne des valeurs entrant dans ces tranches, j'ai toujours false dans mon top

Merci pour toutes réponses qui pourraient m'aider.

Cordialement