// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Globalization; using System.Text.RegularExpressions; namespace E { public class Program { private static readonly Regex re = new Regex(@"\d{2}/\d{2}/\d{2}", RegexOptions.Compiled); public static DateTime Parse(string s) { return DateTime.Parse(re.Match(s).Value, new CultureInfo("en-US")); } public static void Main(string[] args) { Console.WriteLine(Parse("05/07/08(-4%)")); Console.WriteLine(Parse("09/19/08 DOM 55")); Console.WriteLine(Parse("09/19/2008 DOM 53")); Console.WriteLine(Parse("FOR 09/15/08 -23")); } } }