using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^\d{1,2}([ -.\/])(\d{1,2}|[a-zA-z]{3,15})(?1)\d{2,4}( \d{2}:\d{2}(:\d{2}([.:]\d)?)?)?$|^(\d{1,2}|[a-zA-z]{3,15})([ -.\/])\d{1,2}(?7)\d{2,4}( \d{2}:\d{2}(:\d{2}([.:]\d)?)?)?$|^\d{2,4}([ -.\/])(\d{1,2}|[a-zA-z]{3,15})\d{1,2}(?11)( \d{2}:\d{2}(:\d{2}([.:]\d)?)?)?$";
string input = @"23/02/1993
23-02/1993
23-fev-1993
fev-23-1993
fev.02.93
28-OCT-90
28-OCT-1990
10/28/90
10/28/1990
28.10.90
dd.mm.yyyy
28.10.1990
90/10/28
yyyy/mm/dd
1990/10/28
4 Q 1990
OCT 90
OCT 1990
01:02
01:02:34.75
02:34
02:34.75
20 08:03
20 08:03:00
20-JUN-1990 08:03
20-JUN-1990 08:03:00
1990-06-20 08:03
1990-06-20 08:03:00.0";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx