Bonjour,
J'ai essaye d'utiliser regex pour les taux avec ceci
Ca marche avec les chaines
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!!");
}
}
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

 

 
		
		 
         
 

 
			
			



 Regex avec le taux
 Regex avec le taux
				 Répondre avec citation
  Répondre avec citation 
   
Partager