using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"dst\=((?:10\.)|(?:172\.1[6-9]\.)|(?:172\.2[0-9]\.)|(?:172\.3[0-1]\.)|(?:192\.168\.)).+";
string input = @"dst=192.168.1.2
dst=10.10.10.10
dst=101.20.10.7
dst=11.10.10.10
dst=100.26.23.45
dst=123.123.123.123
dst=172.16.24.36
dst=98.23.45.12
dst=10.20.30.40
";
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