title: How can I replace a regex substring match in Javascript?
body: <pre><code>var str   = 'asd-0.testing';
  var regex = /asd-(\d)\.\w+/;
  
  str.replace(regex, 1);
  </code></pre>
  
  <p>That replaces the entire string <code>str</code> with <code>1</code>. I want it to replace the matched substring instead of the whole string. Is this possible in Javascript?</p>