title: trying to inherit RegularExpressionAttribute, no longer validates
body: <p>I'm trying to inherit the <code>RegularExpressionAttribute</code> to improve reusability with validating SSNs.</p>
  
  <p>I have the following model:</p>
  
  <pre><code>public class FooModel
  {
      [RegularExpression(@"^(?!000)(?!666)(?!9[0-9][0-9])\d{3}[- ]?(?!00)\d{2}[- ]?(?!0000)\d{4}$", ErrorMessage = "The SSN you entered is invalid. If you do not have this number please leave the field blank")]
      public string Ssn { get; set; }
  }
  </code></pre>
  
  <p>which will validate correctly on the client and server.  I wanted to encapsulate that lengthy regular expression into its own validation attribute like so:</p>
  
  <pre><code>public class SsnAttribute : RegularExpressionAttribute
  {
      public SsnAttribute() : base(@"^(?!000)(?!666)(?!9[0-9][0-9])\d{3}[- ]?(?!00)\d{2}[- ]?(?!0000)\d{4}$")
      {
          ErrorMessage = "SSN is invalid";
      }
  }
  </code></pre>
  
  <p>Then I changed my <code>FooModel</code> like so:</p>
  
  <pre><code>public class FooModel
  {
      [Ssn(ErrorMessage = "The SSN you entered is invalid. If you do not have this number please leave the field blank")]
      public string Ssn { get; set; }
  }
  </code></pre>
  
  <p>Now the validation doesn't render the unobtrusive data attributes on the client.  I'm not quite sure as to why, since this seems like the two should essentially be the same thing.</p>
  
  <p>Any suggestions?</p>