only letters and spaces regex code example
Example 1: only letters and spaces regex
/^[a-zA-Z\s]*$/g
Example 2: regex only letters not spaces
var re = /^[A-Za-z]+$/;
Example 3: regex for letters and spaces
/* Note this works with the onkeyup function in html with js */
function lettersandSpacesOnly(input){
var regexs = /[^a-z ]*$/gmi;
input.value = input.value.replace(regexs, "");
}