Stack Overflow archive
0 score

Extract correct combination of digits from string

score
0
question views
101
license
CC BY-SA 3.0

This works with all the examples from your logcat messages:

java
Pattern pattern = Pattern.compile("\\d+\\.\\d+(\\.[\\d]+)?");
Matcher matcher = pattern.matcher(NewVersion);
if (matcher.find()) {
  String version = matcher.group();
}

https://regex101.com/r/P7lICp/1

Personally, I would rethink what you are doing.

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.