簡體   English   中英

如何在條件正則表達式中添加空格

[英]how to add white space into conditional regex

我的其中一個屬性具有以下數據注釋:

[RegularExpression(@"A|B|C|A and B", ErrorMessage = "You must select one.")]

當我提交值“ A和B”時,它不接受該值,但是如果我發布“ A”,“ B”或“ C”,則該值通過。 我將如何做到這一點,以便完整的字符串“ A和B”將被接受。

將“ A和B”放在括號中:

[RegularExpression(@"A|B|C|(A and B)", ErrorMessage = "You must select one.")]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM