Android 密码格式验证的正则表达式
6-16位数字字母混合,不能全为数字,不能全为字母,首位不能为数字
public boolean isPassword(String password){
String regex="^(?![0-9])(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$";
Pattern p=Pattern.compile(regex);
Matcher m=p.matcher(password);
boolean isMatch=m.matches();
Log.i(TAG, "isPassword: 是否密码正则匹配"+isMatch);
return isMatch;
}
由数字,英文,中文组成的正则:
String regex="^[a-zA-Z0-9\u4E00-\u9FA5]+$"
Java正则?=,?!的用法
https://blog.csdn.net/yh18668197127/article/details/85956811
附上手机号格式验证(正则)
https://blog.csdn.net/yh18668197127/article/details/85629597