Referring to this question here. I have a new Problem. I want to extract the last two appearing numbers (longitude/latitude) from a String.
I use the approach from the referenced answer. A simple example where the error occures can be found here:
public static void main(String[] args) {
String input = "St. Louis (38.6389, -90.342)";
Pattern p = Pattern.compile("-?[\\d\\.]+");
Matcher m = p.matcher(input);
while(m.find()){
System.out.println(m.group());
}
}
Console output is as following:
.
38.6389
-90.342
The Problem appears to be the "." in "St. Louis". Can someone help me to solve this issue in a nice way?
Thanks a lot for every answer/comment.