c# - regex for interval of years -
In C #, I want to write a regular expression that will accept years between 1900 and 2099 only.
I tried ^ ([1] [9] \ d \ d | [2] [0] \ d \ d) $
, but it does not work . Any ideas?
Then I have a class:
[NotNullValidator (MessageTemplate = "Lipseasena little! Do not drink!")] // [Rangelavidetter (1900, rangeboundary type ), 2100, rangeboundary type. Unique, Message Template = "Ancel Trebui Sa Contina 4 Factors!") [Reggae Validate (@ "(19 | 20) \ D {2} $", MessageTemplate = "Anil Trebui Sa Efi Valid!", Rullet = "Valid_an")] Public Entrepreneurship {Received; Set; }
and in a test method:
public {anUnivBO} = {AnUnivBO} {anStart = 2009} }; Validation result vr = validation Validate & lt; AnUnivBO & gt; (Target, "valid_an"); Assert.IsTrue (vr.IsValid); }
Why is this unsuccessful?
String property for RegexValidator, not an integer, to do one thing:
public string anStart {get; Set; }
In your testing method, you will need to use it:
AnUnivBO target = new ANUNIBO () {anStart = "2009"};
To continue using an integer:
[range evaluator (1900, rangeboundary type .institute, 2099, rangeboundary type. ] Receive public antentext analysis { Set; )
Comments
Post a Comment