简体   繁体   English

必须至少包含数字和字符正则表达式

[英]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.

相关问题 正则表达式:必须至少包含一个数字和字母,但不能包含其他字符/空格 - RegEx: Must have at least one number and letter but no other characters / whitespace 正则表达式Javascript(必须具有1个数字和字符) - Regex Javascript (Must have 1 number and characters) 密码的正则表达式必须至少包含八个字符,至少一个数字以及大小写字母和特殊字符 - Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters 正则表达式:必须至少有一个数字、一个字母并且应该允许空格 - RegEx: Must have at least one number, one letter and should allow whitespaces 正则表达式 - 至少1个数字,1个字母,1个特殊字符和至少3个字符 - Regex - At least 1 number, 1 letter, 1 special character and at least 3 characters 正则表达式密码必须有一个字母和一个数字或一个符号,至少八个字符 - Regex Password must have a letter and either a number or a symmbol, minimum of eight characters Javascript正则表达式,表示“至少X个字符,带有大写字母和数字” - Javascript regular expression for “at least X characters, have a capital letter and a number” 密码包含至少6个字符,1个数字,1个字母和任何特殊字符的JavaScript正则表达式 - JavaScript regex for password containing at least 6 characters, 1 number, 1 letter, any special characters 最少 6 个字符的密码 REGEX,至少一个字母和一个数字,可以包含特殊字符 - Password REGEX with min 6 chars, at least one letter and one number and may contain special characters 纱线错误:没有场景; 必须至少有一个 - Yarn ERROR: There are no scenarios; must have at least one
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM