写一段js代码,完成字段校验规则:必须包含大小写字母和数字。

var regex = new RegExp("^(?=.[a-z])(?=.[A-Z])(?=.*[0-9]).{8,}$"); if(regex.test(yourString)){ console.log('The string is valid.'); } else { console.log('The string is not valid.'); }

猜你喜欢

转载自blog.csdn.net/weixin_42602241/article/details/129565248