I need to find strings that match a particular pattern. For example in the following condition:
if("1.6.1.1.60885.5".matches("1.6.1.1.n.5".replaceAll("n", "\\\\d{0,10}")))
then it should be true, since n can be any integer. 60885 is an integer. This works fine.
if("1.6.1.1.60885".matches("1.6.1.1.n.5".replaceAll("n", "\\\\d{0,10}")))
then it should be false. But I get this also as true.
I just need the n to be any integer but the dots position has to be considered. Can anyone suggest how can I achieve this.