Password Strength Check Using Regex In Java

Password Strength Check Using Regex In Java

ยท

2 min read

Hi there everyone. ๐Ÿ‘‹ How's your weekend going?
Hope you are doing well. ๐Ÿ™‚

So, as you read the title, I am gonna share with you about creating a password strength check app using Regex in Java

Prerequisites ๐ŸŽ’

  • A bit of knowledge of Java,
  • A bit of knowledge of Regex,
  • Willing to code.

Coding

String regex = "^[a-zA-Z0-9].{6,}+$"
public class PasswordStrength{
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        System.out.println("Plz enter a password to check its strentgh");
        String password = sc.nextLine();
        String regex = "^[a-zA-Z0-9].{6,}+$";
        if(password.matches(regex))
        {
            System.out.println("Strong");
        }else{
            System.out.println("Plz create a strong password");
        }
    }
}

Hope you like this article/tutorial of my series Random-Coding.
Please read my other articles of this series as well for more cool and fun projects.

I will meet you through my next article soon. Till then, stay connected with me through Twitter and Discord

Keep Coding, keep growing โ˜•๏ธ

References: ๐Ÿ“š