In a regular expression, the \d metacharacter is used to represent an integer, but to represent it in Java code, you need to use \\d as a regular expression because of the double analysis performed on them.
First, a string parser that converts it to \d , and then a regex parser that will interpret it as an integer metacharacter (which we want).
For "one or more" parts, we use + greedy quantifier.
For presentation . we use \\. due to double parsing scenario.
So in the end we have (\\d)+(\\.) .
source share