Nitin Kabra Nitin Kabra - 10 months ago 44
Javascript Question

Regular Expression for alphabets with spaces

I need help with regular expression. I need a expression which allows only alphabets with space for ex. college name.

I am using :

var regex = /^[a-zA-Z][a-zA-Z\\s]+$/;

but it's not working.


Just add the space to the [ ] :

var regex = /^[a-zA-Z ]*$/;