using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"2(?:12|4[1-9]|5[1-9]|6[0-9]|7[0-8]|8[1-35-8]|9[1-5]|3[45789])|4(?:1[246]|2[46])";
string substitution = @"";
string input = @"248, 281, 282, 283, 235, 247, 278, 243, 244, 245, 246, 273, 278, 235, 285, 286, 288,
241, 242, 243, 245, 249, 258, 287, 212, 259, 268, 269, 237, 235, 238, 246, 247, 251,
252, 253, 271, 273, 274, 275, 212, 234, 239, 287, 291, 292, 295, 255, 256, 257, 293,
294, 276, 277, 271, 272, 212, 251, 253, 254, 261, 262, 263, 264, 265, 266, 267, 271,
275, 260, 270, 412, 414, 424, 416, 426";
RegexOptions options = RegexOptions.Multiline;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
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