Sample:
private static Pattern r = Pattern.compile("(.*\\..*\\..*)\\..*");
Line:
sentVersion = "1.1.38.24.7";
I do:
Matcher m = r.matcher(sentVersion);
if (m.find()) {
guessedClientVersion = m.group(1);
}
I expect 1.1.38, but pattern matching fails. If i switch toPattern.compile("(.*\\..*\\..*)\\.*");
// note that I am deleting the ".". until the last *
then 1.1.38.XXXfails
My goal is to find (xxx) in any input line.
Where am I mistaken?
Gjain source
share