title: how to use path-to-regexp to match all paths that's not starting with /api/?
body: <p>when using <a href="https://github.com/pillarjs/path-to-regexp" rel="noreferrer">path-to-regexp</a>, how to match all path that not starting with <code>/api/</code>?</p>
  
  <p>By using native JavaScript RegExp <code>/^(?!\/api\/).*/</code>will match<code>/x/y/z</code>. see test result from <a href="https://regex101.com/#javascript" rel="noreferrer">here</a>
  <a href="https://i.stack.imgur.com/rZe1k.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rZe1k.png" alt="enter image description here"></a></p>
  
  <p>However, it does not work with path-to-regexp. see the test result from <a href="http://forbeslindesay.github.io/express-route-tester/" rel="noreferrer">there</a></p>
  
  <p><a href="https://i.stack.imgur.com/EvwPF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EvwPF.png" alt="enter image description here"></a></p>
  
  <p><strong>So what's the correct way to achieve my goal in path-to-regexp?</strong></p>
  
  <p><strong>[Update 1]</strong></p>
  
  <p>More details:
  The real case is that I'm using angular2 + koajs. And in angular2, browser may issue a client routing url to server. Please see my <a href="https://stackoverflow.com/questions/39096211/whats-the-right-way-to-set-routing-for-angular2-with-koajs">another question</a> about this.</p>
  
  <p>To address that issue, as suggested by @mxii, I'm trying to use <a href="https://github.com/xsmallbird/koa-repath" rel="noreferrer">koa-repath</a> to redirect all requests that not started with <code>/api/</code> to the root url: <code>http://localhost:3000/</code>excepte it's static assets (js/json/html/png/...) requests.</p>
  
  <p>And <code>koa-repath</code> use <code>path-to-regexp</code> to match the path. That's why I asked this question.</p>