using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(\d+)\s+(.+?)\s+\((\d+ matches)";
string input = @" 10 permit 10.8.1.26 (1284 matches)
20 permit 10.8.2.200 (22 matches)
30 permit 10.8.3.200 (160 matches)
40 permit ip host 10.8.1.26 any
";
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