Bonjour,

J'ai essaye d'utiliser regex pour les taux avec ceci



public Pattern conventionRates = Pattern.compile("^([^ ]{3}) (([^ ]{3}) | ([^ ]{6})) ([0-9]+)([^ ])([^ ]*)([ ]*)(.*)");

public String convention(String s)
{
Matcher matcherRates = conventionRates.matcher(s);
if (matcherRates.find())
{
String currency = matcherRates.group(1);
String type = matcherRates.group(2);
Integer i = Integer.valueOf(matcherRates.group(3));
String unit = matcherRates.group(4));
String pageNumber = matcherRates.group(5);
String extraTypeInfo = matcherRates.group(7);

return currency + "_" + type + "_" + i.toString() + unit;
}
else
{
throw new RunTimeException(s + " does not match index format!!");

}

}

Ca marche avec les chaines

EUR LIB 6M AM
USD CMS 10Y PM

mais ca ne marche pas avec
EUR LIBSTR 6M AM
USD CMSSTR 10Y PM

Avez-vous une idee comment modifier l'expression regex pour que ca marche avec les patterns LIB ou LIBSTR ....?

Merci