regular expression to allow only alphabets and spaces code example Example: only letters and spaces regex /^[a-zA-Z\s]*$/g