Can I use my RegularExpression attribute instead of the DataAnnotations one?
Posted
by Davy
on Stack Overflow
See other posts from Stack Overflow
or by Davy
Published on 2009-09-27T14:03:43Z
Indexed on
2010/05/30
13:02 UTC
Read the original article
Hit count: 293
I'm trying to use a reusable regex class and use along with DataAnnotations in MVC. Something like:
[RegularExpressionAttribute1(typeof(MyRegex))]
This compiles but no error is thrown if the property doesn't match.
It all works with the standard
[RegularExpression(@"^\s*\d+(\.\d{1,2})?\s*$")]
© Stack Overflow or respective owner