fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text.RegularExpressions;
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var s = "[ad-sad]asd.,/?|\":{{}[a!@#$%^&()**d [en]aedasd;";
  10. var results = Regex.Matches(s, @"\[([\w-]+)](.*?)(?=\[[\w-]+]|$)")
  11. .Cast<Match>()
  12. .Select(x => new[] {x.Groups[1].Value, x.Groups[2].Value});
  13. foreach (var result in results)
  14. {
  15. Console.WriteLine($"{result[0]} => {result[1]}");
  16. }
  17. }
  18. }
Success #stdin #stdout 0.09s 26540KB
stdin
Standard input is empty
stdout
ad-sad => asd.,/?|":{{}[a!@#$%^&()**d 
en => aedasd;