Password matching expression. Password must be at least 4 characters, no more than 8 characters, and must include at least one upper case letter, one lower case letter, and one numeric digit. Expression: ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$ public class LoginViewModel { [ Required (ErrorMessage= "Required" )] [ Display (Name = "User name" )] public string UserName { get ; set ; } [ Required (ErrorMessage = "Required" )] [ DataType ( DataType .Password)] [ RegularExpression ( "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$" , ErrorMessage = "Password Alphanumeric Only. Minimum length 8" )] [ Display (Name = "Password" )] public string Password { get ; set ; } }