开发者

Need a regex that does not care if less than 6 characters are entered

开发者 https://www.devze.com 2023-02-07 15:05 出处:网络
I have this regex that cause my validation message to fire because it requires 6 characters. I need a Regex that allows any amount of characters:

I have this regex that cause my validation message to fire because it requires 6 characters. I need a Regex that allows any amount of characters:

var unFieldRegEx = /^(?=.*[a-zA-Z\d])(\w|[\.\@\-\?\,\&am开发者_运维技巧p;\''\/\_\""]){6,}$/;


change {6,} to * for 0 or more characters. Change it to + for 1 or more characters.


var unFieldRegEx = /^(?=.*[a-zA-Z\d])(\w|[\.\@\-\?\,\&\''\/\_\""])*$/;

should do it (remove the length specifier @ the end and replace with a *)

0

精彩评论

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