Skip to content
Advertisement

How to match two or more words name in javascript regex?

I’m trying to verify that there are at least two words name, where a word is only alphabet for example:

JavaScript

This is the regex I’m currently using just to verify letters and spaces

JavaScript

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]*

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement