/*身f证验证*/
let cardId=445222198409130049
if (!(/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}(\d|x|X)$/.test(cardId))) {
console.log('身f证格式错误');
} else {
console.log('身f证正确');
}
/*回乡证验证*/
if (!(/(H|M)(\d{10})$/.test(cardId))) {
console.log('回乡证格式错误');
} else {
console.log('回乡证正确');
}
/*港澳居民来往内地通行证*/
if (!(/^([A-Z]\d{6,10}(\(\w{1}\))?)$/.test(cardId))) {
console.log('港澳证格式错误');
} else {
console.log('港澳证正确');
}
/*手机号码验证*/
if (!(/^1\d{10}$/.test(cardId))) {
console.log('港澳证格式错误');
} else {
console.log('港澳证正确');
}
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!