using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"Item.+";
string input = @"Parker Tech
74 Lincoln Green Lane
Church Stoke, PA 19402
(123) 456-7890
Invoice
Submitted on 9/9/2016
Invoice for
Name
Company name
Email
Street address
City, State, Zip
Payable to
Bobby John
Bobby Co.
bobby@john.com
Project
Project name
Invoice #
12345
Due date
9/16/2016
Description Qty Unit price Total price
Item #1 1 $200.00 $200.00
Item #2 2 $200.00 $400.00
$0.00
$0.00
Notes: Subtotal $600.00
Adjustments -$100.00
$500.00";
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