You are viewing a single comment's thread. Return to all comments →
MY SOLUTION -- USING REGEX PATTERN IN JAVA
Pattern num_regex = Pattern.compile("[0-9]"); Pattern small_alpha_regex = Pattern.compile("[a-z]"); Pattern cap_alpha_regex = Pattern.compile("[A-Z]"); Pattern special_regex = Pattern.compile("[-!@#$%^&*()-+]"); int min_len = 6; int count = 0; if (num_regex.matcher(password).find() && small_alpha_regex.matcher(password).find() && cap_alpha_regex.matcher(password).find() && special_regex.matcher(password).find() && n < min_len) { while (n != min_len) { n++; count++; } } if (!num_regex.matcher(password).find()) count++; if (!small_alpha_regex.matcher(password).find()) count++; if (!cap_alpha_regex.matcher(password).find()) count++; if (!special_regex.matcher(password).find()) count++; n += count; if (n >= min_len) return count; while (n != min_len) { n++; count++; } return count;
Seems like cookies are disabled on this browser, please enable them to open this website
Strong Password
You are viewing a single comment's thread. Return to all comments →
MY SOLUTION -- USING REGEX PATTERN IN JAVA