Reputation: 101
I'm writing a program that let people enter their infomation (name, age....) .For the name input I don't want them to left blank and allow only letters and spaces but not start with space.
What is the appropriate regex? I tried with : ^[a-zA-Z\\s]*$
but it didn't work.
Thanks!
Upvotes: 0
Views: 442
Reputation: 311393
You should specify the first character separately:
^[a-zA-z][a-zA-Z\\s]*$
Upvotes: 3