fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string[] strings = { "LUB", "Pgm", "Regn", "Month", "Year", "Bywhat" };
  9.  
  10. foreach (string s in strings)
  11. {
  12. string filter = @"[[LUB,=,COMMERCIAL],AND,[Pgm,=,PRIVATE],AND,[Regn,=,Rasna],AND,[Month,=,06],AND,[Year,=,2018],AND,[Bywhat,=,M]]";
  13. string pattern = string.Format(@"(?<=\[{0},=,)[^]\r\n]+(?=\])", s);
  14. var m = Regex.Match(filter, pattern);
  15. Console.WriteLine(m.Value);
  16. }
  17. }
  18. }
Success #stdin #stdout 0.04s 134592KB
stdin
Standard input is empty
stdout
COMMERCIAL
PRIVATE
Rasna
06
2018
M