title: Parse multiline BBCode with C# Regex
body: <p>I'm working on a C# class to parse BBCodes out of text pulled from a database for PHPBB posts.
  On the PHPBB there is a custom BBCode added which looks like this:</p>
  
  <pre><code>[deck={TEXT1}]{TEXT2}[/deck]
  </code></pre>
  
  <p>Which, sitting in the database, looks like this:</p>
  
  <pre><code>[deck=FirstText:13giljne]Large Multiline Text[/deck:13giljne]
  </code></pre>
  
  <p>I'm attempting to replace that using a Regex in C#.
  My C# looks like this:</p>
  
  <pre><code>string text = "[deck=FirstText:13giljne]Large Multiline Text[/deck:13giljne]";
  string replace = "my replacement string";
  string pattern = @"\[deck=((.|\n)*?)(?:\s*)\]((.|\n)*?)\[/deck(?:\s*)\]";
  RegexOptions options = RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline;
  Regex regex = new Regex(pattern, options);
  string result = regex.Replace(text, replace);
  </code></pre>
  
  <p>I'm pretty sure it all just comes down to my Regex pattern being wrong. Which comes as no surprise to me, since Regex isn't exactly my strong suit.</p>
  
  <p>Thanks in advance. Any help is greatly appreciated.</p>
  
  <p>EDIT: Since some people found it unclear, I'll add larger examples.</p>
  
  <p>Source text:</p>
  
  <pre><code>[deck=Foo:13giljne]
      Item #1
      Item #2
      Item #3
      Item #4
  [/deck:13giljne]
  </code></pre>
  
  <p>Desired result:</p>
  
  <pre><code>&lt;span&gt;Foo&lt;/span&gt;
  &lt;div&gt;
      Item #1
      Item #2
      Item #3
      Item #4
  &lt;/div&gt;
  </code></pre>
  
  <p>Hopefully this gives a clearer picture of what I'm trying to do.</p>