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 = "This is a [normal string ] made up of # different types # of characters";
  10. var results = Regex.Split(s, @"(\[[^][]*]|#[^#]*#)|\s+")
  11. .Where(x => !string.IsNullOrEmpty(x));
  12. Console.WriteLine(string.Join("\n", results));
  13.  
  14. }
  15. }
Success #stdin #stdout 0.08s 20696KB
stdin
Standard input is empty
stdout
This
is
a
[normal string ]
made
up
of
# different types #
of
characters