SyntaxFix
Write A Post
Hire A Developer
Questions
To validate for only letters and spaces, try this
String name1_exp = "^[a-zA-Z]+[\-'\s]?[a-zA-Z ]+$";