dd.MM.yyyy のようなパターンを見つけることができる正規表現パターン ストレージはありますか?
データ注釈を使用してデータ検証を使用しています。
[RegularExpression(@"pattern", ErrorMessage = "incorrect date format")]
public string MyDate { get; set; }
dd.MM.yyyy のようなパターンを見つけることができる正規表現パターン ストレージはありますか?
データ注釈を使用してデータ検証を使用しています。
[RegularExpression(@"pattern", ErrorMessage = "incorrect date format")]
public string MyDate { get; set; }
短い月と閏年をチェックしないパターン:
string pattern = @"(0[1-9]|[12][0-9]|3[01])\.(0[1-9]|1[012])\.(19|20)\d\d"
ECMAScript 仕様によると、簡単な答えは次のようになります。
^(\d{2}).\d{2}.(\d{4})$
次のようなものを使用できます。
\d{1,2}\\.\d{1,2}\\.(19\d\d|20\d\d)
「RegExBuddy」や「Rad Software Regular Expression Designer」などの正規表現ツールをいつでも使用できます。
しかし、あなたが望んでいた正規表現はおそらく次のようなものです:
\d{2}.\d{2}.\d{4}?