fork(2) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10.  
  11. var entities= new List<string>(){"101", "102", "103",};
  12. var files= new List<string>(){"101_F05_20101001.cvs", "102_F05_20101001.cvs", "201_F05_20101001.cvs", "202_F05_20101001.cvs"};
  13.  
  14. //var regex = new Regex(@"^(\d*)_F05_\d*\.csv$");
  15. //var res = files.Where(s => !regex.IsMatch(entities)).ToList();
  16. var list = files
  17. .Where(x => entities.Any(y => x.Contains(y) && x.Substring(0, y.Length) == y))
  18. .ToList();
  19.  
  20. foreach (var s in list) {
  21. Console.WriteLine(s);
  22. }
  23. }
  24. }
Success #stdin #stdout 0s 131520KB
stdin
Standard input is empty
stdout
101_F05_20101001.cvs
102_F05_20101001.cvs