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

Popular posts from this blog

monitor web browser programmatically in Android? -

ios - iPhone/iPad different view orientations in different views , and apple approval process -

Shrink a YouTube video to responsive width -