I want a regex in which user have to type at least one character and one number in password field.
Right now I'm using using this:
^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$
but it is not working properly.
Please help.
Hey Try this expression
^\d*[a-zA-Z][a-zA-Z0-9]*$
Try a few tests and you'll see this'll pass any alphanumeric string where at least one non-numeric character is required.
尝试这个 :
^.*(?=.{1,10})(?=.*\d)(?=.*[a-zA-Z]).*$
Try this
// at least one number, one character
// at least six characters
var re = /(?=.*\d)(?=.*)(?=.*).{6,}/;
return re.test(str);
这将标识一个数字,后跟一个字母,或者一个字母,后跟一个数字,中间有任意数量的非数字/字母字符。
/([0-9].*[a-zA-Z])|([a-zA-Z].*[0-9])/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.