title: Extract substring by regex
body: <p>I'm trying to extract a resource id using regex into a variable.</p>
  
  <p>So far I managed to match the string, but I'm confused as to how to extract the digits into a separate value.</p>
  
  <pre><code>"/posts/23/edit".match(/\/posts\/(\d*)\/edit/g)
  // =&gt; ["/posts/23/edit"]
  </code></pre>