Issue
private Boolean validatePass() {
String val = pass.getEditText().getText().toString().trim();
String passwordVal = "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$";
if (val.isEmpty()) {
pass.setError("*Required");
return false;
} else if (!val.matches(passwordVal)) {
pass.setError("Invalid Password");
return false;
} else {
pass.setError(null);
return true;
}
}
I used this code for password Validation, what's wrong with this?
Solution
As per what your regex code is it should satisfy for all the symbols mentioned there #,?,!,@,$,%,^,&,*,- it will fail if you use symbols other than these like _,+,~,`
Answered By - Nandala Abhinav
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.