[英]must at least have number and characters regex
I still don't understand how to use regex and there is regex like this : 我仍然不明白如何使用正则表达式,并且有这样的正则表达式:
/^[a-zA-Z0-9\s]+$/
and i use it in javascript 我在javascript中使用它
$('#oldPass, #newPass, #confpass').keydown(function (e) {
var inputValue = e.key;
if(inputValue.match(/^[a-zA-Z0-9\s]+$/)){
return;
}else{
e.preventDefault();
}
});
it works, i can't type anything beside alphanumeric, but how can i make that the new password must contain combination number and characters? 它有效,我不能在字母数字旁边输入任何内容,但是如何使新密码必须包含组合数字和字符?
Minimum of 8 letters with atleast one letter and number. 至少8个字母,至少一个字母和数字。
^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}
check this link for verification https://regex101.com/r/DcxNSc/1 检查此链接以进行验证https://regex101.com/r/DcxNSc/1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.