The first if condition should be true if it encounters this kind sequence e.g, 1,2,3...9 except 0 and it only allows 1 digit to pass. The second if is true if it has this sequence 12, 22, 33 .. 99 except for 01,02...09. It only allows two digits to be passed. But for some reason the first condition allows two or more digits and it doesn't go to the next condition.
Pattern num1 = Pattern.compile("([1-9&&[^0]]){1}");
Matcher matchNum1 = num1.matcher(min);
Pattern num2 = Pattern.compile("[1-9[^0]]{2}");
Matcher matchNum2 = num2.matcher(min);
if (matchNum1.find()) {
System.out.println("contains number and no trailing zeroes " + min );
}
else if (matchNum2.find()) {
System.out.println("contains 2 numbers " + min);
}
else {
System.out.println("No match");
}