title: C# Multi Spintax - Spin Text
body: <p>I got this class that I'm using for spin text.</p>
  
  <pre><code>    public class Spinner
      {
          private static Random rnd = new Random();
          public static string Spin(string str)
          {
              string regex = @"\{(.*?)\}";
              return Regex.Replace(str, regex, new MatchEvaluator(WordScrambler));
          }
          public static string WordScrambler(Match match)
          {
              string[] items = match.Value.Substring(1, match.Value.Length - 2).Split('|');
              return items[rnd.Next(items.Length)];
          }
      }
  </code></pre>
  
  <p>But I need it to be able to spin multi spintax text.</p>
  
  <p>As example
  {1|2} - {3|4}</p>
  
  <p>Returns: 2 - 4
  So it works.</p>
  
  <p>But:
  {{1|2}|{3|4}} - {{5|6}|{7|8}}</p>
  
  <p>Returns: 2|4} - {5|7}</p>
  
  <p>So it doesn't work if there is spintax inside spintax.</p>
  
  <p>Any help? :)</p>