A Pen by Vinil Kumar Kadimi

Thumbnail
This awesome code was written by vinil_kadimi, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright vinil_kadimi ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Vinil Kumar Kadimi</title>
  
  
  
  
  
</head>

<body>

  
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/vinil_kadimi/a-pen-by-vinil-kumar-kadimi-zRQaJL */
var validateTelNumber = function validateTelNumber(num) {
  var regex = /^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{4})(?: *x(\d+))?\s*$/;
  var re = new RegExp(regex, 'ig');
  return re.test(num);
};

console.log('1st', validateTelNumber('+1 732 964 1303'));
console.log('1st', validateTelNumber('+1 732 964 1303'));

Comments