using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; public static class Test { public static void Main() { var s = "A Borrower (or the Parent) may not deliver a Utilisation Request if as a result of the proposed Utilisation:
[10] or more Term Loans [(other than Incremental Company Loans)] would be outstanding; [or]
[15] or more Revolving Company Utilisations would be outstanding[; or
[20] or more Incremental Company Loans would be outstanding].
A Borrower (or the Parent) may not request that a Company A Loan [or an Incremental Company Loan] be divided if, as a result of the proposed division, [ 25 ] or more Company A Loans [or [ 50 ] or more Incremental Company Loans] would be outstanding.
[A Borrower (or the Parent) may not request that a Company B Loan or a Company C Loan be divided.]"; var result = s.Split(new[] {"
"}, StringSplitOptions.None) .SkipWhile(x => !x.Contains("other than Incremental Company Loans")) .MagicTakeWhile(x => !x.EndsWith(".") && !x.EndsWith(";")); Console.WriteLine(string.Join("\n", result)); } public static IEnumerable MagicTakeWhile(this IEnumerable data, Func predicate) { foreach (var item in data) { yield return item; if (!predicate(item)) break; } } // Reference: https://stackoverflow.com/a/11883524/3832970 }