C# Regular Expression to validate a date?

后端 未结 10 1788
后悔当初
后悔当初 2020-12-30 04:45

I am trying to validate a date entered into a text box. There is an input mask on the textbox which forces input of xx/xx/xxxx. I am trying to use a regular expression valid

10条回答
  •  -上瘾入骨i
    2020-12-30 05:27

    The above regular expression is correct for dd/mm/yyyy format. the expression is

    (^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)|([2]([0]{1})))([0-9]{2}))))$)
    

提交回复
热议问题