using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?:INSERT_|UPDATE_)?([NY|80]{2}[0-9]{6})_([^0-9]*)_([0-9]{4})_06_30\.(?:txt|csv)";
string input = @"UPDATE_80070175_LOCATION_MARKING_PERIOD_2020_06_30.txt
INSERT_80070175_STUDENT_CLASS_GRADE_DETAIL_2020_06_30.txt
INSERT_80070175_STUDENT_CLASS_ENTRY_EXIT_2020_06_30.txt
INSERT_80070175_STUD_ATTEND_DAY_2020_06_30.txt
INSERT_80070175_PROGRAMS_FACT_2020_06_30.txt
INSERT_80070175_DAY_CALENDAR_2020_06_30.txt
INSERT_80070175_CRSE_INSTRUCT_ASSIGNMENT_2020_06_30.txt
INSERT_80070175_COURSE_2020_06_30.txt
INSERT_80070175_ATTENDANCE_CODES_2020_06_30.txt
80070175_STUDENT_LITE_UPDATE_2020_06_30.txt
80070175_SCHOOL_ENTRY_EXIT_INSERT_2020_06_30.txt
";
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