Alphabets validation using javascript and php

What is the regular exprn to validate alphabets including space character

The code below gives validate names like ‘Anjana’

When i enter a name like ‘anjana menon’ its not validating…

var txtname=document.getElementById(“txt_name”).value;

var filter=/[1]+$/;
var test_bool = filter.test(txtname);
alert(‘Please Enter Only Alphabets in the Name Field’);
return false;

Pls help…:injured:

  1. a-zA-Z ↩︎

var filter=/^[a-z ]+$/i;


var filter=/^[\\w ]+$/i;

make sure to keep space before ] in that expression.

var filter=/^[\\w\\s]+$/;

Note that the ‘only alphabets in name’ validation may result in John O’Connor or Sean O’Shea getting rejected.

The JavaScript Form Validation script and [URL=“”]PHP form validation script can make validations easier