可能重复:
How to validate that user enters string in textbox in asp mvc4
在添加正则表达式之前,它工作正常。
public class Customer
{
[Required]
[RegularExpression(@"^[a-zA-Z''-'\s]{1,40}$",
ErrorMessage="Numbers and special characters are not allowed in the last name.")]
public string LastName { get; set; }
}
我收到了错误。 asp mvc4中的字符串验证有什么问题?