js正则表达式验证身份证号 /** * @return {boolean} */ function IsCard(str) { var reg = /(^d{15}$)|(^d{18}$)|(^d{17}(d|X|x)$)/; return reg.test(str); }