Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace Regular_Expression
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] calender = {
- "1/02/2019",
- "01/12/1990",
- "11/12/1990",
- "00/12/1990",
- "01/12/19900",
- "99/12/1990"
- };
- for (int i = 0; i < calender.Length; i++)
- {
- string pattern = @"^(0?[1-9]|[12]\d|3[01])/(0[1-9]|1[0-2])/\d{4}$";
- bool ismatch = Regex.IsMatch(calender[i], pattern);
- Console.WriteLine(ismatch);
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment