手机号码、密码的正则验证规则


1.验证手机号码是否符合规则,包括主流的号段
var mobile={
validate_mobile:function (mobile){
var mobilePattern={mobile: /^(((13[0-9])|(14[5-7])|(15[0-9])|(17[0-9])|(18[0-9]))+\d{8})$/ };
if(!mobilePattern.mobile.test(mobile)){
return false;
}
return true;
}
}
2.验证密码时候符合规则--包含数字和英文字母

validate_password:function(password){
var passwordPattern=/^(?![0-9]+$)(?![a-zA-Z]+$)[a-zA-Z\d]{6,16}$/;
if(!passwordPattern.test(password)){
return false;
}
return true;
},


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM