title: Regular Expression Validation displaying error even when string is a match
body: <p>The problem is as follows,</p>
  
  <p>The regular expression validation message on my view is being shown when another validation message is present, this happens even when the string matches the expression and seems like it is being triggered by other validation messages.</p>
  
  <pre><code>View 
  
      [Required]
      [DataType(DataType.Password)]
      [RegularExpression(@"^(?=.{8})(?=.*[a-z])(?=.*[A-Z])(?=.*\d)", ErrorMessage = "message")]
      [Display(Name = "New Password")]
      public string NewPassword { get; set; }
  
      [Required]
      [DataType(DataType.Password)]
      [Compare("NewPassword")]
      [Display(Name = "Confirmation Password")]
      public string NewPasswordConfim { get; set; }
  </code></pre>
  
  <p>In the above model I have my regular expression that should enforce a password with 1 lowercase, 1 uppercase and 1 numeric character, the other validation is comparing the password confirmation with the new password field.</p>
  
  <p>The reg expression / val message works when the string is valid or the confirmation field matches the new password field but if the confirmation field does not match then both validation messages display.</p>
  
  <pre><code>Controler
  
      if (Regex.IsMatch(model.NewPassword, @"^(?=.{8})(?=.*[a-z])(?=.*[A-Z])(?=.*\d)"))
              {
                  if (model.NewPassword != model.NewPasswordConfim)
                  {
                      return View("PasswordResetVerification", model);
                  }
              }
  </code></pre>
  
  <p>In my controler I added a check to make sure that the reg expression is valid (as a test) and this check has shown me in cases where the string is a match to the expression but the confirmation password field does not match the new password field the reg expression error message is still displayed in error.</p>
  
  <pre><code>View
  
     &lt;div class="form-group"&gt;
                  &lt;label class="col-md-2 control-label" for="NewPassword"&gt;New Password&lt;/label&gt;
                  &lt;div class="col-md-4"&gt;
                      &lt;input type="password" class="form-control" id="NewPassword" name="NewPassword" placeholder="Password" value="@Model.NewPassword" /&gt;
                      @Html.ValidationMessageFor(m =&gt; m.NewPassword)
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="form-group"&gt;
                  &lt;label class="col-md-2 control-label" for="NewPasswordConfim"&gt;Confim New Password&lt;/label&gt;
                  &lt;div class="col-md-4"&gt;
                      &lt;input type="password" class="form-control" id="NewPasswordConfim" name="NewPasswordConfim" placeholder="Confim Password" value="@Model.NewPasswordConfim" /&gt;
                      @Html.ValidationMessageFor(m =&gt; m.NewPasswordConfim)
                  &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/34pha.png" alt="The result of a new password of qW345678 and a confirmation of qW3456789 (non mathcing)"></p>