C# Regular Expression to validate a date?

后端 未结 10 1831
后悔当初
后悔当初 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条回答
  •  感动是毒
    2020-12-30 05:40

    Kettenbach had a problem. His co-worker suggested using regexs. Kettenbach then had two problems.

    As others have said, use DateTime.TryParse or DateTime.TryParseExact on a custom validator and save yourself the nightmare that is regex :)

提交回复
热议问题