fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. List<string> _separator = new List<string>(){"existing item"};
  11. Regex containsDelimitersInBrackets = new Regex(@"\[([^][]*)]");
  12.  
  13. List<string> _sequence = new List<string>(){"test[1] test[2]", "test[123]"}
  14. .SelectMany(s =>
  15. containsDelimitersInBrackets.Matches(s)
  16. .Select(m =>
  17. m.Groups[1].Value
  18. )
  19. ).ToList();
  20.  
  21. _separator.AddRange(_sequence);
  22. _separator.ForEach(s => Console.WriteLine(s));
  23. }
  24. }
Success #stdin #stdout 0.08s 30524KB
stdin
Standard input is empty
stdout
existing item
1
2
123