Reputation: 12437
I have the following data annotation for one of my properties:
[RegularExpression(@"A|B|C|A and B", ErrorMessage = "You must select one.")]
When I submit the value "A and B" it does not accept this, but if i post "A", "B", or "C" it passes. How would i make it so the full string "A and B" will accept.
Upvotes: 0
Views: 91
Reputation: 14376
Put the "A and B" in parentheses:
[RegularExpression(@"A|B|C|(A and B)", ErrorMessage = "You must select one.")]
Upvotes: 1