using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(?i)(?!-+\s+Page\s+\d+-+|Python\s+Regular\s+Expression\s+\d{2}.+\d{4}|.+Python\s+Proprietary|PYTHON\s+RE SPECIFICATION\s+Version.+\s+page\s+\d+|Python\s+Regular\s+Expression\s+Specification).+$";
string input = @"
This module provides regular expression matching operations.
Regular expressions use the backslash character ('\') to indicate special forms
or to allow special characters to be used without invoking their special
meaning.
Python Regular Expression 02 December 1999
Python Proprietary
----------------------- Page 292-----------------------
PYTHON RE SPECIFICATION Version 2.7 [Vol 9, Part Q] page 983
Python Regular Expression Specification
It is important to note that most regular expression operations are available as
module-level functions and RegexObject methods. The functions are shortcuts that
don’t require you to compile a regex object first, but miss some fine-tuning
parameters.
";
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