title: Javascript - replace string between brackets, but the brackets should stay
body: <p>I'd like to replace character inside a string, e.g.</p>
  
  <p>Drafts [<strong>2</strong>]</p>
  
  <p>To:</p>
  
  <p>Drafts [<strong>3</strong>]</p>
  
  <p>This regex returns only Drafts <strong>3</strong>:</p>
  
  <pre><code>str.replace(/\[(.+?)\]/g, 3)
  </code></pre>
  
  <p>Thanks for help in advance</p>