I have a text box where i get the last name of user. How do I allow only one hyphen (-) in a regular expression?
^([a-z A-Z]*-){1}[a-z A-Z]*$
If it matches .*-.*-, then you have more than one hyphen and such string should not be accepted
.*-.*-