Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript regex only letters and spaces

//regex expression:
var reg_name_lastname = /^[a-zA-Zs]*$/;

//Validation to the user_name input field
if(!reg_name_lastname.test($('#user_name').val())){ //
    alert("Correct your First Name: only letters and spaces.");
    valid = false;
}
 
PREVIOUS NEXT
Tagged: #javascript #regex #letters #spaces
ADD COMMENT
Topic
Name
3+6 =