I want to make a registration system in java. It's in a very good progress. I only have one specific problem. The password weakness. I made that, tha password must be longer than 8 character with a simple
if(password.getText().length() > 8) { error message }
I also put a condition just like that:
if(... < 8 || !(password.getText().contains("1"))) { error message }
But with this condition it only accept the password if your password for example: asdfghjk1 So I tried the condition with a lot of || condition like !....contains("2")..|| !..contains("9")
But with theese conditions it only works when the password is: 123456789 But what i really want to do is a password, that longer than 8 character, contains at least one capital and at least one number. Is that any way to do that? By the way I use Java swing.