Skip to content

Instantly share code, notes, and snippets.

@tamimibrahim17
Created July 22, 2020 10:10
Show Gist options
  • Save tamimibrahim17/5d0111f43164b577306099d67356d250 to your computer and use it in GitHub Desktop.
Save tamimibrahim17/5d0111f43164b577306099d67356d250 to your computer and use it in GitHub Desktop.
Bangladeshi Mobile Number validation in javascript using regex patter
// phone numbers
var numbers = ['01988123456','+8801988123456','8801988123456','01788123456','+8801788123456','8801788123456','01688123456','+8801688123456','8801688123456','01388123456','+8801388123456','8801588123456','01588123456','8801888123456','01888123456'];
function validate_bdnumber(number)
{
pattern = /^\+?(88)?0(19|14|17|13|18|16|15)\d{8}$/
return number.match(pattern) ? true : false;
}
numbers.forEach(function(number){
console.log(validate_bdnumber(number));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment