Created
July 22, 2020 10:10
-
-
Save tamimibrahim17/5d0111f43164b577306099d67356d250 to your computer and use it in GitHub Desktop.
Bangladeshi Mobile Number validation in javascript using regex patter
This file contains hidden or 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
// 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