Skip to content

Instantly share code, notes, and snippets.

@lequi
Last active September 13, 2019 04:06
Show Gist options
  • Save lequi/fdd9f22b7efb2f394674ed4a57fd45a7 to your computer and use it in GitHub Desktop.
Save lequi/fdd9f22b7efb2f394674ed4a57fd45a7 to your computer and use it in GitHub Desktop.
Hàm detect số điện thoại di động ở Việt Nam (bao gồm cả đầu số di động mới)
function is_mobilephone_number(phoneNumber) {
    phoneNumber = phoneNumber.replace(/\D/g, '').replace(/^(\+|)84/g, '0');
    return /^(01[2689]|09|08[12345689]|07[06789]|03[23456789]|05[2689])[0-9]{7,8}$/g.test(phoneNumber);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment