简单实例:
string s = "2005-2-21";
Regex reg = new Regex (@"(?<y>d{4})-(?<m>d{1,2})-(?<d>d{1,2})",RegexOptions .Compilé);
Match match = reg.Match(s);
int année = int.Parse(match.Groups["y"].Value);
int mois = int.Parse(match.Groups["m"].Value);
int jour = int .Parse(match.Groups["d"].Value);
DateTime heure = new DateTime (année, mois, jour);