Last active
April 17, 2025 10:01
-
-
Save tungvn/2460c5ba947e5cbe6606c5e85249cf04 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); | |
} |
Cảm ơn anh!
Thanks anh
Cảm ơn anh ^^
/(?:\+84|0084|0)[235789][0-9]{1,2}[0-9]{7}(?:[^\d]+|$)/g
-> updated Jun 26 2024 for phone & mobile phone
/(?:\+84|0084|0)[235789][0-9]{1,2}[0-9]{7}(?:[^\d]+|$)/g
-> updated Jun 26 2024 for phone & mobile phone
nice
thank a lot!
thank you sir!!
/(?:+84|0084|0)[235789][0-9]{1,2}[0-9]{7}(?:[^\d]+|$)/g
thank you
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
const isValidPhone = phone => /(([03+[2-9]|05+[6|8|9]|07+[0|6|7|8|9]|08+[1-9]|09+[1-4|6-9]]){3})+[0-9]{7}\b/g.test(phone)