Forked from tungvn/regex-vietnamese-phone-number-updated-2018.js
Created
January 6, 2023 04:55
-
-
Save iamkem/e13b8c2ff12092826be7d220f34c1667 to your computer and use it in GitHub Desktop.
Vietnamese phone number Regex validation
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
| /* | |
| Before Septemper 15 2018, Vietnam has phone number start with 09*, 01(2|6|8|9). | |
| After that, the phone number can start with 03, 05, 07 or 08. | |
| So this function provide a way to validate the input number is a Vietnamese phone number | |
| */ | |
| function isVietnamesePhoneNumber(number) { | |
| return /(03|05|07|08|09|01[2|6|8|9])+([0-9]{8})\b/.test(number); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment