c# - Why when I use RegularExpression as DataAnnotation is not recognizing the leading zeros? -
i have field in entity have regularexpression dataannotation:
@"^\$?([0-9]{6})(.[0-9]){0,1}?$"
and works fine, except when use zeros before number.
ex.
- 123456.1 work - 012345.1 not work
if same validation regex.ismatch says ok.
how can force mvc keep leading zeroes when validation?
at end used string variable , worked:
^\$?([0-9]{6})(\.[0-9])?$
- i followed @sinsedrix , @michelle advice
Comments
Post a Comment