bootstrap正则表达式验证手机 座机 邮箱

$('#CusForm').bootstrapValidator({
        fields : {
            //验证手机
            'customer.mobile' : {          //input中的name 值
                validators:{
                    regexp: {
                        regexp: /^1\d{10}$/ ,
                        message: '请输入正确的11位手机号'
                    }
                    
                }
            },
            //验证座机
            'customer.phone' : {
                validators:{
                    regexp: {
                        regexp: /^$|(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/ ,
                        message: '请输入正确座机电话'
                    }
                    
                }
            },
            //验证邮箱
            'customer.email' : {
                validators:{
                    regexp: {
                        regexp: /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/ ,
                        message: '请输入正确的邮箱地址'
                    }
                    
                }
            },
    
            
        }
    });

 

posted @ 2017-06-13 17:09  小菜鸟。  阅读(3856)  评论(0编辑  收藏  举报