正则表达式验证银行卡号

 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,位数也不同

posted @ 2017-08-18 14:57  Martin_lee  阅读(2276)  评论(0编辑  收藏  举报