The Java matches method returns 'true' for all of the following
// check if a string ends with an exact number of digits (yyyyMMdd 8 digits)
String s20180122_1 = "fileNamePrefix_20171219";
String s20180122_2 = "fileNamePrefix_20171219131415111";
System.out.println(s20180122_1.matches(".*\\d{8}$"));
System.out.println(s20180122_2.matches(".*\\d{8}$"));
System.out.println(s20180122_2.matches(".*\\d{8,8}$"));
Since the s20180122_2 has more digits I expect the 2nd and 3rd checks to return 'false', but they don't. How do I enforce the exact (8 digits only. No more, no less) match?
Thanks for your help.