using System.Text.RegularExpressions;
public static void Main()
PrintMatches("01 Title - Fee Description to Payee Name");
PrintMatches("01 Title - Fee to Description to Payee Name");
static void PrintMatches(string inputString)
Match match = ExtractInformation(inputString);
string index = match.Groups["Index"].Value;
string feeName = match.Groups["FeeName"].Value;
string payeeName = match.Groups["PayeeName"].Value;
Console.WriteLine("Index: " + index);
Console.WriteLine("FeeName: " + feeName);
Console.WriteLine("PayeeName: " + payeeName);
static Match ExtractInformation(string input)
string pattern = @"^(?<Index>\d{2})\sTitle\s-\s(?<FeeName>.*(?=\sto\s))\sto\s(?<PayeeName>.+)$";
return Regex.Match(input, pattern);