正则验证身份证号

SFZHChange() {
console.log((/(^\d{15}$)|(^\d{17}([0-9]|X|[*])$)/.test(this.dataInfo.sfz)));
if (!(/(^\d{15}$)|(^\d{17}([0-9]|X|[*])$)/.test(this.dataInfo.sfz))) {
const toast = this._toast.info('请输入正确的身份证号', 1000, null, false);
}
}
原文地址:https://www.cnblogs.com/guirong/p/15741638.html