js正则表达式验证身份证号

         /**
          * @return {boolean}
          */
         function IsCard(str) {
                 var reg = /(^d{15}$)|(^d{18}$)|(^d{17}(d|X|x)$)/;
                 return reg.test(str);
         }
原文地址:https://www.cnblogs.com/NotPig/p/12855479.html