c# - How do I allow only one hyphen (-),only one space( ),only one apostrophe (') in a regular expression -
i have text box last name of user. how allow 1 hyphen (-),only 1 space( ),only 1 apostrophe (') in regular expression
you can use negative lookahead each of 3 chars want avoid :
^(?!.*-.*-.*)(?!.*'.*'.*)(?!.*\s.*\s.*)[a-za-z- ']+$
Comments
Post a Comment