title: Regex to substring then compare
body: <p>I have the below code in my mvc application:</p>
  
  <pre><code>[Required(ErrorMessageResourceName = "NumberRequired",  ErrorMessageResourceType = typeof (Messages))]
  [RegularExpression("^[0-9]{16}$", ErrorMessageResourceName = "NumberRequired", ErrorMessageResourceType = typeof (Messages))]
  public string number{ get; set; }
  
  [Required(ErrorMessageResourceName = "LastFourRequired", ErrorMessageResourceType = typeof(Messages))]
  [RegularExpression("^[0-9]{4}$", ErrorMessageResourceName = "LastFourRequired", ErrorMessageResourceType = typeof(Messages))]
  public string lastfour{ get; set; }
  </code></pre>
  
  <p>My problem is i need to validate the lastfour. It must be equal to the last four digit of number. I need to do that validation in this block of code.</p>
  
  <p>Can somebody help me? Thanks in advance!</p>