正则验证身份证号

var regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;

    if (!regIdCard.test(wxb.that.data.idcard)){
      wx.showToast({
        image: '/img/kulian.png',
        title: '请输入正确的身份证号',
      })
      return false
    }