title: Remove square brackets at beginning and ending of string
body: <p>I would like to remove square brackets from beginning and end of a string, if they are existing.</p>
  
  <pre><code>[Just a string]
  Just a string
  Just a string [comment]
  [Just a string [comment]]
  </code></pre>
  
  <p>Should result in</p>
  
  <pre><code>Just a string
  Just a string
  Just a string [comment]
  Just a string [comment]
  </code></pre>
  
  <p>I tried to build an regex, but I don't get it in a correct way, as it doesn't look for the position:</p>
  
  <pre><code>string.replace(/[\[\]]+/g,'')
  </code></pre>