正则表达式验证银行卡号

 BPM.blockUI({ target: $("#blockAddDiv"), boxed: true, message: FeekongLan.label.loadmsg });//增加锁定
                        var pattern = /^([1-9]{1})(d{14}|d{18})$/,
	                    str = $("#CardCode").val().replace(/s+/g, "");
                        if (!pattern.test(str)) {
                            var msgModel = { MsgType: "warning", msg: "请正确输入银行卡号!", result: false, msgTitle: "系统提示" };
                            BPM.ShowMsg(msgModel);
                            $("#CardCode").focus();
                            BPM.unblockUI($("#blockAddDiv")); //解除锁定
                            return false;
                        }


银行卡首位非0,位数也不同

原文地址:https://www.cnblogs.com/MartinLee/p/7622533.html