using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"_(1[6-9]|2[0-4])$";
string input = @"x2016_17_7
x2017_188
x2018_199
x2019_20_10
x2020_21_11
x2021_22_12
x2022_23_13
x2023_20_10
x202025_15
x2016_17_16
x2017_18_17
x2018_19_18
x2019_20_19
x2020_21_20
x2021_22_21
x2022_23_22
x2023_20_23
x2020_25_20";
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