[Solved] Extracting two numbers from a string using java


For this you don’t even need regex. Just split the String and call the right indices:

String latLongString = "Tracking info Latitude: 3.9574667 Longitude: 7.44882167"; //yours obviously won't be hardcoded
String[] split = latLongString.split(" ");
String lat = split[3];
String lon = split[5];

solved Extracting two numbers from a string using java