title: Javascript increment number between square brackets
body: <p>This is my text input box</p>
  
  <pre><code>&lt;input class="tb" id="tb43[0]" type="text" size="30" maxlength="200" /&gt;
  </code></pre>
  
  <p>When cloning with jQuery I'd like the id of the new cloned box to be <strong>"tb43[1]"</strong>.</p>
  
  <pre><code>$clone.find(".tb").attr("id").replace(/\d+/, function (val) { return parseInt(val) + 1; });
  </code></pre>
  
  <p>This only increments the first number but how can I manage to increment the number in the square brackets?</p>
  
  <p>Thanks</p>