using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"SUBJECT COMPANY:\s+COMPANY DATA:(?:\s+(?:(?:COMPANY CONFORMED NAME:\s+(?'conformed_name'[^\n]+))|(?:CENTRAL INDEX KEY:\s+(?'CIK'\d{10}))|(?:STANDARD INDUSTRIAL CLASSIFICATION:\s+(?'assigned_SIC'[^\n]+))|(?:IRS NUMBER:\s+?(?'IRS_number'\w{2}-?\w{7,8}))|(?:STATE OF INCORPORATION:\s+(?'state_of_incorporation'\w{2}))|(?:FISCAL YEAR END:\s+(?'fiscal_year_end'(?:0[1-9]|1[0-2])(?:0[1-9]|[1-2][0-9]|3[0-1])))\n))+";
string input = @"SUBJECT COMPANY:
COMPANY DATA:
CENTRAL INDEX KEY: 0000737243
STANDARD INDUSTRIAL CLASSIFICATION: []
IRS NUMBER: 592332857
COMPANY CONFORMED NAME: ACORN VENTURE CAPITAL CORP
STATE OF INCORPORATION: DE
FISCAL YEAR END: 1231
<REPORTING-OWNER>
COMPANY DATA:
COMPANY CONFORMED NAME: HERTZOG CALAMARI & GLEASON
CENTRAL INDEX KEY: 0000904440
STANDARD INDUSTRIAL CLASSIFICATION: []
<RELATIONSHIP>OFFICER";
RegexOptions options = RegexOptions.Singleline;
Match m = Regex.Match(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