Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
プロパティの 1 つに次のデータ注釈があります。
[RegularExpression(@"A|B|C|A and B", ErrorMessage = "You must select one.")]
値「A and B」を送信すると、これは受け入れられませんが、「A」、「B」、または「C」を投稿すると合格します。完全な文字列「A and B」が受け入れられるようにするにはどうすればよいですか。
「AとB」を括弧で囲みます。
[RegularExpression(@"A|B|C|(A and B)", ErrorMessage = "You must select one.")]