Regular Expression for alphabets with spaces

前端 未结 8 1942
庸人自扰
庸人自扰 2020-12-13 18:34

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-         


        
8条回答
  •  忘掉有多难
    2020-12-13 18:42

    This will allow space between the characters and not allow numbers or special characters. It will also not allow the space at the start and end.

    [a-zA-Z][a-zA-Z ]+[a-zA-Z]$
    

提交回复
热议问题