【发布时间】:2020-07-08 06:26:22
【问题描述】:
我在 ViewModel 中使用 RegularExpression 注释应用了客户端验证。
验证是 GroupName 应该以 TPDC_ 或 DMK_ 开头并至少再加一个字母
[Required(ErrorMessage = "Group Name is required")]
[RegularExpression("^(TPDC_|DMK_)+", ErrorMessage = "Group Name should begin with TPDC_ or DMK_")]
public string GroupName { get; set; }
但是使用的正则表达式没有按预期工作。
【问题讨论】:
标签: .net regex asp.net-mvc