Skip to content

Instantly share code, notes, and snippets.

@yetanotherdev267
Last active April 9, 2020 08:53
Show Gist options
  • Save yetanotherdev267/c6527355c605b8d72546 to your computer and use it in GitHub Desktop.
Save yetanotherdev267/c6527355c605b8d72546 to your computer and use it in GitHub Desktop.
Vietnamese Mobile Phone Regex Test

Vietnamese Mobile Phone Regex Test

JavaScript

var regEx = /^0(1\d{9}|9\d{8})$/;
var phone = '0912345678';
var match = regEx.test(phone);

PHP

$regEx = '/^0(1\d{9}|9\d{8})$/';
$phone = '0912345678';
$match = preg_match($regEx, $phone);
@gnortpro
Copy link

gnortpro commented Apr 9, 2020

Test with new number 033...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment