if (password1.length() >= 15){
final String PasswordPattern = "^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])[0-9A-Za-z]{15,}$";
Pattern pattern = Pattern.compile(PasswordPattern);
Matcher matcher = pattern.matcher(password1);
if(matcher.matches() == true){
if (password1.equals(password2)){
SavePreferences(password1.toString());
//Intent intent = new Intent(LockAppActivity.this, ScreenLockActivity.class);
Intent intent = new Intent(LockAppActivity.this, PhoneNumActivity.class);
startActivity(intent);
}
else{
pass1.setText("");
pass2.setText("");
Toast.makeText(LockAppActivity.this,"Both passwords are not equal!",Toast.LENGTH_SHORT).show();
}
}
我希望用户输入至少 15 个字符的密码,必须由大写和小写字母、数字和符号组成。但我只知道如何用大写字母和小写字母和数字创建图案...如何在图案中包含所有符号...请检查我的图案代码部分...谢谢