正则 (密码长度为8到20位,必须包含字母和数字,字母区分大小写)

var pattern = /^(?=.*[0-9])(?=.*[a-zA-Z])(.{8,20})$/;
if(!pattern.test(this.password)){
	uni.showToast({
		title:'密码由8-20位数字或英文字母组成',
		icon:'none'
	})
	return false;
}

你可能感兴趣的:(前端)