开发者

How can I change this regex?

/^(?=.*\d)(?=.*[A-Za-z]).{6,}$/

At the moment it checks at least 1 number and at least one letter present.

开发者_开发技巧

How can I make it at least one number and at least 1 upper case letter??

Thanks all.


The part that matches the letter is [A-Za-z]. This is a character class, signified by the square brackets, meaning that it will match any single character specified inside the brackets. In this case, it will match any uppercase letter (A-Z) or lowercase letter (a-z). To make it match uppercase letters only, simply remove the lowercase part so it looks like this: [A-Z].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜