how to check if a string has only alphabets in javascript
if (!/[^a-zA-Z]/.test(word))
how to check if a string has only alphabets in javascript
if (!/[^a-zA-Z]/.test(word))
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);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us