I need to validate a String in java to meet below requirement,
- The letters a to z (upper and lowercase) (zero or many times) -
[a-zA-Z]
- The single quote character (zero or one time) -
??
- The space character (zero or one time) -
??
- Any other character should not be accepted
I tried with many expressions but couldn't get to work with the number of occurrences (2nd and 3rd point)
How can I achieve this?