Regular expression for name with spaces allowed in between the text and avoid spaces when there is no text

Viewed 19679

Hello I'm trying to write a regular expression for user name in my form.

The regular expression should allow spaces and . when the text is written

Ex : S. Harish Kumar

Check the regEx that I have written so far

^[a-zA-Z\s\.]*$

The above regEx also accepts any string with just spaces and . which I don't want. Can you help me with the perfect regEx which doesn't accept spaces and . when no text is entered?

Thanks in advance :)

3 Answers
Related