using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^((0|1)[0-9])\/([0-3][0-9])\/([0-9][0-9])";
string input = @"01/01/20
02/01/20
03/01/20
04/01/20
05/01/20
06/01/20
07/01/20
08/01/20
09/01/20
10/01/20
11/01/20
12/01/20
01/32/20
01/03/20
01/04/20
01/05/20
01/06/20
01/07/20
01/08/20
01/09/20
01/10/20
01/11/20
01/12/20
01/13/20
01/14/20
01/15/20
01/16/20
01/17/20
01/18/20
01/19/20
01/20/20
01/21/20
01/22/20
01/23/20
01/24/20
01/25/20
01/26/20
01/27/20
01/28/20
01/29/20
01/30/20
01/31/20
";
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