Answers for "how to validate name in javascript using regular expression"

1

js regex valid name

//^[a-z\u00C0-\u02AB'´`]+\.?\s([a-z\u00C0-\u02AB'´`]+\.?\s?)+$

function isValidName(myval) {
    var validCharactersRegex = /^[a-z\u00C0-\u02AB'´`]+\.?\s([a-z\u00C0-\u02AB'´`]+\.?\s?)+$/;
 
    return validCharactersRegex.test(myval.trim());
}
Posted by: Guest on October-29-2020
2

how to validate a string using regular expression in javascript

function validate(){
  var phoneNumber = document.getElementById('phone-number').value;
  var postalCode = document.getElementById('postal-code').value;
  var phoneRGEX = /^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-\s\.]{0,1}[0-9]{4}$/;
  var postalRGEX = /^[A-Z]{1,2}[0-9]{1,2} ?[0-9][A-Z]{2}$/i;
  var phoneResult = phoneRGEX.test(phoneNumber);
  var postalResult = postalRGEX.test(postalCode);
  alert("phone:"+phoneResult + ", postal code: "+postalResult);
}
Posted by: Guest on March-07-2021

Code answers related to "how to validate name in javascript using regular expression"

Code answers related to "Javascript"

Browse Popular Code Answers by Language