title: How to create custom validation attribute for MVC
body: <p>I'd like to create a custom validation attribute for MVC2 for an email address that doesn't inherit from RegularExpressionAttribute but that can be used in client validation.  Can anyone point me in the right direction?</p>
  
  <p>I tried something as simple as this:</p>
  
  <pre><code>[AttributeUsage( AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false )]
  public class EmailAddressAttribute : RegularExpressionAttribute
  {
      public EmailAddressAttribute( )
          : base( Validation.EmailAddressRegex ) { }
  }
  </code></pre>
  
  <p>but it doesn't seem to work for the client.  However, if I use RegularExpression(Validation.EmailAddressRegex)] it seems to work fine.</p>