using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<!last calendar) day (of the month )?(next )?(preceding|prior to) (any|an|each) (interest|Bond) payment";
string input = @"following day of the month next preceding an interest payment date
these day of the month next preceding an Interest Payment Date (each a ""Record Date"")
last day of the month preceding any Bond Payment
record date shall be defined as the fifteenth (15 th ) day preceding any interest payment date.
The Record Date is the last calendar day of the month preceding each Interest Payment Date, whether or not such day is a Business Day.
calendar month immediately preceding an interest payment
calendar month next preceding each Interest Payment Date.
(whether or not a business day) of the calendar month before the interest payment
interest payable on the Bonds on any interest payment date means the close of business on the 15th day of the preceding month.
month prior to an Interest Payment
day preceding any interest payment
immediately preceding an interest payment date";
RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnoreCase;
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