Hi all, I'm learning how to format strings. I've made the following code, but the console screen just comes up blank.
static void Main(string[] args)
{
DateTime ci = DateTime.Now; //instance of datetime
Console.WriteLine("{0:D}", ci);
string info = "Fred Savage- SSN: 143-14-8756 Phone: (281)414-3424 Email: fsavage@blah.com";
string format = @"(?<name>Fred\d+\s+)\s*(?<ss>SSN:\d+\s+)\s*(?<phone>Phone:\d+\s+)\s*(?<email>Email:\d+\s+)";
Match nameMatch = Regex.Match(info, format);
if (nameMatch.Success)
{
Console.Write(nameMatch.Groups[1]);
Console.Write(nameMatch.Groups[2]);
Console.Write(nameMatch.Groups[3]);
Console.Write(nameMatch.Groups[4]);
}
Console.ReadKey();
}
Any help would be appreciated