I have a regular expression data annotation:
[StringLength(100)]
[Display(Description = "Password")]
[RegularExpression(@^((?=.*[a-z])(?=.*[A-Z])(?=.*\d)).+$)], ErrorMessage = " must include at least one upper case letter,one lower case letter and one numeric digit")]
public string Password { get; set; }
How can I display an Error Message based on the reason the validation failed?
If the password is 12345678 then tell the user he didn't include at least 1 upper case and 1 lower case.
If the password is abcdefgH then the Error message will be:"must insert at least 1 digit".