I’m trying to verify that there are at least two words name, where a word is only alphabet for example:
// Should pass Jean Acker Mary Kay Adams Elizabeth Allen Alba Bailey Blanche Baker Bowen Collinge Marie // ...and so on more than two words // Should Fail Ryan Filbert77 Mark 21 Franz.Dimaz
This is the regex I’m currently using just to verify letters and spaces
/^[aA-zZs]+$/
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]*