This question is a continuation of the question here:
Why is char [] preferred over String for passwords?
This question is great for understanding why it is useful to use char [] instead of String; however, it does not explain how to safely perform password checking on char []. This is what I would like to learn about here.
Simply put, I need to check if the password meets the following requirements:
- Contains at least one uppercase letter
- Contains at least one lowercase letter
- Contains at least one digit
- Contains at least one character
- At least n characters, but no more than m
Now I understand how I can use regular expressions to perform validation ... these answers show how to do this:
, . , , . A char [], , .
, , char [], ?
, , . .
Java .
String.matches(String regex)
Pattern pattern = Pattern.compile(String regex);
pattern.matcher(CharSequence testString).matches();
, char [].