using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?i)Store number – ([\d\D]*)\n.*StreetA – ([\d\D]*)\n.*City – ([\d\D]*)\n.*State_id – ([\d\D]*)\n.*Postal Code – ([\d\D]*)\n.*Store Name – ([\d\D]*)\n.*Phone Number – ([\d\D]*)\n.*Tax Rates.*\n.*Tax table 1 – ([\d\D]*)\n.*Tax table 2 – ([\d\D]*)\n.*Tax table 3 – ([\d\D]*)\n.*Tax table 4 – ([\d\D]*)\n.*Tax table 5 – ([\d\D]*)\n.*Artistree vendor – ([\d\D]*)\n.*Store Group – ([\d\D]*)\n.*Store Zone number – ([\d\D]*)";
string input = @"FP Team,
Please install the Live database for store 1384. The updates have been completed.
• Store number – 1384
• StreetA – 1275 York Rd, Ste 21A
• City – Gettysburg
• State_id – PA
• Postal Code – 17325-7565
• Store Name – Gettysburg, PA
• Phone Number – (717) 420-8200
• Tax Rates
o Tax table 1 – 6.0000%
o Tax table 2 – 0.0000%
o Tax table 3 – 0.0000%
o Tax table 4 – 0.0000%
o Tax table 5 – N/A
• Artistree vendor – Kernersville
• Store Group – US.201308
• Store Zone number – 2030";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx