regex for letters and spaces

JavaScript
/* 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, "");
  }
var re = /^[A-Za-z]+$/;

Source

Also in JavaScript: