javascript regex only letters and spaces

Solutions on MaxInterview for javascript regex only letters and spaces by the best coders in the world

showing results for - "javascript regex only letters and spaces"
Sabri
11 Jan 2017
1//regex expression:
2var reg_name_lastname = /^[a-zA-Z\s]*$/;
3
4//Validation to the user_name input field
5if(!reg_name_lastname.test($('#user_name').val())){ //
6    alert("Correct your First Name: only letters and spaces.");
7    valid = false;
8}
9