I am trying to check whether a password is alphanumeric or not using regex but I am not getting the result I expect. What is the problem with the below code?
boolean passwordOnlyAlphaNumericCheck = false;
Pattern patternAlphaNumericCheck = Pattern.compile("^[a-zA-Z0-9]$");
Matcher matcherAlphaNumericCheck = patternAlphaNumericCheck.matcher(login.getPassword());
if(matcherAlphaNumericCheck.find())
passwordOnlyAlphaNumericCheck = true;
Thanks for help
Aucun commentaire:
Enregistrer un commentaire