I’m trying to verify that there are at least two words name, where a word is only alphabet for example:
JavaScript
x
13
13
1
// Should pass
2
Jean Acker
3
Mary Kay Adams
4
Elizabeth Allen Alba Bailey
5
Blanche Baker Bowen Collinge Marie
6
// ...and so on more than two words
7
8
// Should Fail
9
Ryan
10
Filbert77
11
Mark 21
12
Franz.Dimaz
13
This is the regex I’m currently using just to verify letters and spaces
JavaScript
1
2
1
/^[aA-zZs]+$/
2
I have searched and tried one of them on this link but it didn’t work link
Can anyone help me to verify name more than 1 word?
Advertisement
Answer
try this:
([a-zA-Z]{1,})+s+([a-zA-Z]{1,})+[a-zA-Zs]*