Created
June 23, 2018 17:32
-
-
Save saaiful/f213324c5deb95e0b098d052ddddd2e5 to your computer and use it in GitHub Desktop.
Vee-Validate mobile number validator (Bangladesh)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import VeeValidate from 'vee-validate'; | |
Vue.use(VeeValidate, { inject: false }); | |
VeeValidate.Validator.extend('mobile', { | |
getMessage: field => `The number is not valid for Bangladesh.`, | |
validate: value => { | |
var strongRegex = new RegExp("^(8801[756891]{1}[0-9]{8}|01[756891]{1}[0-9]{8})$"); | |
if(value=='') return true; | |
return strongRegex.test(value); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment