title: Regex excluding square brackets
body: <p>I am new to regex. I have this regex:</p>
  
  <pre><code>\[(.*[^(\]|\[)].*)\]
  </code></pre>
  
  <p>Basically it should take this:</p>
  
  <pre><code>[[a][b][[c]]]
  </code></pre>
  
  <p>And be able to replace with:</p>
  
  <pre><code>[dd[d]]
  </code></pre>
  
  <p>abc, d are unrelated.  Needless to say the regex bit isn't working. it replaces the entire string with "d" in this case.</p>
  
  <p>Any explanation or aid would be great!</p>
  
  <p>EDIT:</p>
  
  <p>I tried another regex,</p>
  
  <pre><code>\[([^\]]{0})\]
  </code></pre>
  
  <p>This one worked for the case where brackets contain no inner brackets and nothing else inside. But it doesn't work for the described case.</p>