using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @/
^(?<nr_classe>(\d{4,}))([\x20\t\-]{1,}|[a-zA-Z]|$)
/;
string input = @"250156304 - 6 ANO A INTEGRAL ANUA
250156445 - 7 ANO A INTEGRAL ANUA
250794211 - 2ª SERIE A INTEGRAL ANUA
250794484 - 2ª SERIE B INTEGRAL ANUA
250795069 - 3ª SERIE A INTEGRAL ANUA
250795291 - 3ª SERIE B INTEGRAL ANUA
250797255 - 6 ANO A INTEGRAL ANUA
250797644 - 7 ANO A INTEGRAL ANUA
250797800 - 7 ANO B INTEGRAL ANUA
250798147 - 8 ANO A INTEGRAL ANUA
250798493 - 9 ANO A INTEGRAL ANUA
250798725 - 9 ANO B INTEGRAL ANUA
251327540 - 8 ANO A TARDE ANUA
251327755 - 8 ANO B TARDE ANUA
251328951 - 7 ANO A TARDE ANUA
251329173 - 7 ANO B TARDE ANUA
251329173 -7 ANO B TARDE ANUA
251331013 - 6 ANO A TARDE ANUA
252381546 - 6074 - INFORMATICA PARA INTERNET - 1ª SERIE NT MANHA ANUA";
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