I want to extract the amount in Euro out of a string via a regular expression.
Presently I get only 5
as a result and cannot understand my error. How has a suitable solution to look like to detect also variants like 17,05 Euro
or 85 EUR
in my string?
String regExp = ".*([0-9]+([\\,\\.]*[0-9]{1,})?) *[Eu][Uu][Rr][Oo]? .*";
Pattern pattern = Pattern.compile(regExp);
String input1 = "aerae aerjakaes jrj kajre kj 112123 aseraer 1.05 Eur aaa";
Matcher matcher = pattern.matcher(input1);
matcher.matches();
System.out.println(matcher.group(1));
Result:
5