using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^\[.*\]\n+((?:;;.*\n+)+)";
string input = @"[TITLE]
[OPTIONS]
;;Options Value
;;------------------ ------------
FLOW_UNITS CFS
<MORE TEXT>
[PATTERNS]
;;Name Type Multipliers
;;-------------- ---------- -----------
;Daily pattern generated from time series '2-166:2-165 (obs)'. Average value was 0.0485 MGD.
2-166:2-165_(obs)_Daily DAILY 1.011 1.008 1.06 0.908 1.072 0.998 0.942
<MORE TEXT>
[COORDINATES]
;;Node X-Coord Y-Coord
;;-------------- ---------------- ----------------
<MORE TEXT>
[JUNCTIONS]
;; Invert Max. Init. Surcharge Ponded
;;Name Elev. Depth Depth Depth Area
;;-------------- ---------- ---------- ---------- ---------- ----------
1-1 837.85 15.25 0 0 0
<MORE TEXT>
[REPORT]
INPUT YES
CONTROLS NO
<MORE TEXT>";
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