Hi looking for help on a project, I need Java program that indicates if the input string is a valid password. Requirements are it should be at between 8 and 15 characters in length, it should contain at least one uppercase character and it should contain at least one digit (number). Any help will be very much appreciated.
String passwd = "Asscw1q2";
String pattern = "^(?=.*[0-9])(?=.*[A-Z]).{8,15}$";
System.out.println(passwd.matches(pattern));
(?=.*[0-9])- atLeast 1 digit
(?=.*[A-Z])- atLeast 1 upperCase
.{8,15}- 8 <= Length <= 15
prints true if the pattern matches.