bootstrap 用户 可以是手机也可以是邮箱 验证 怎么实现呢?

user_name: {
validators: {
emailAddress: {
message: '邮箱地址格式有误'
}
}
}

        这是验证邮箱格式

callback: {
message: '用户名格式错误!邮箱或手机号~',
callback: function (value) {

regphone = /^1[3,4,5,6,7,8,9]\d{9}$/;
regemail = /^([a-zA-Z0-9_.-])+\@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
if (regphone.test(value) === true) {
return true
}
if(regemail.test(value) === true) {

return true
}

return false

                                                        }
                                                    }                   


                                                                                                        这个是可以实现我想要的   

一般通过正则表达式实现,如

$('#customer').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: '邮箱地址格式有误'
                    }

                }
            },


        }
    });