Skip to content

Instantly share code, notes, and snippets.

@hieuhuynh93
Forked from yetanotherdev267/VnMobilePhoneRegEx.md
Created December 28, 2019 10:38
Show Gist options
  • Save hieuhuynh93/b0a1dc05d628c09bbecd1d0ec2c13816 to your computer and use it in GitHub Desktop.
Save hieuhuynh93/b0a1dc05d628c09bbecd1d0ec2c13816 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment