title: JS regex replace number
body: <p>Trying to get my head around some regex using JS .replace to replace an integer with a string.</p>
  
  <p>For example, the string could be:</p>
  
  <pre><code>var string = 'image[testing][hello][0][welcome]';
  </code></pre>
  
  <p>I want to replace the '0' with another value. I was originally using this:</p>
  
  <pre><code>string.replace( /\[\d\]/g, '[newvalue]');
  </code></pre>
  
  <p>But when we start replacing double digits or more (12, 200, 3204, you get what I mean), it stops working properly. Not sure how to get it functioning the way I want it too.</p>
  
  <p>Thanks in advance. Greatly appreciated.</p>