title: Replace regex match in JavaScript
body: <p>For a given URL,</p>
  
  <pre><code>/disconnect/&lt;backend&gt;/foo/&lt;association_id&gt;/
  </code></pre>
  
  <p>I'd like to get</p>
  
  <pre><code>/disconnect/:backend/foo/:association_id/
  </code></pre>
  
  <p>There could be any number of <code>&lt;pattern&gt;</code>s in a path.</p>