C# Regex Error Unterminated [] set
<p>I'm receiving this error (I'm using C#):</p>

<blockquote>
  <p>parsing "(--[[.<em>?]])|(--[[.</em>)" - Unterminated [] set.</p>
</blockquote>

<p>When trying to add Lua's multiple comment code. Here is what it should be:</p>

<pre><code>--[[
  Hello
]]
</code></pre>

<p>However, when I take out the ']]' at the end of this Regex:</p>

<pre><code>(--[[.*?]])|(--[[.*)
</code></pre>

<p>it will give me this error. However, if I add the ']]' in the above, example:</p>

<pre><code>(--[[.*?]])|(--[[.*]])
</code></pre>

<p>it works perfectly fine.</p>

<p>Here is the full code:</p>

<pre><code>Regex CustomCommentRegex1, CustomCommentRegex2, CustomCommentRegex3;
CustomCommentRegex1 = new Regex(@"--.*$", RegexOptions.Multiline | RegexCompiledOption);
CustomCommentRegex2 = new Regex(@"(--[[.*?]])|(--[[.*)", RegexOptions.Singleline | RegexCompiledOption);
CustomCommentRegex3 = new Regex(@"(--[[.*?]])|(.*]])", RegexOptions.Singleline | RegexOptions.RightToLeft | RegexCompiledOption);
</code></pre>

<p>'CustomCommentRegex2' is where I get this 'Unterminated [] set' error. I have an issue if I add the ']]' at the end of 'CustomCommentRegex2'. It will highlight the text above '--[[ ]]' the comments and inside of it; anyway, the issue is this 'Unterminated [] set' error.</p>
