title: URL "starts with" using regex?
body: <p>Say I have the following url:</p>
  <blockquote>
  <p><a href="http://example.com/api" rel="nofollow noreferrer">http://example.com/api</a></p>
  </blockquote>
  <p>How can I create a regex that will match any url <em>starting with</em> that url segment above?</p>
  <p>For example:</p>
  <blockquote>
  <p><a href="http://example.com/api/auth" rel="nofollow noreferrer">http://example.com/api/auth</a> (should match)</p>
  <p><a href="http://example.com/api/orders" rel="nofollow noreferrer">http://example.com/api/orders</a> (should match)</p>
  <p><a href="http://example.com/api/products" rel="nofollow noreferrer">http://example.com/api/products</a> (should match)</p>
  <p><a href="http://example.com/auth" rel="nofollow noreferrer">http://example.com/auth</a> (should not match)</p>
  <p><a href="http://examples.com/api/auth" rel="nofollow noreferrer">http://examples.com/api/auth</a> (should not match)</p>
  <p><a href="https://example.com/api/auth" rel="nofollow noreferrer">https://example.com/api/auth</a> (should not match)</p>
  </blockquote>
  <p>Yes, obviously I could just call <code>string.indexOf(url) == 0</code> to do a &quot;starts with&quot; check, but I specifically need a regular expression because I have to provide one to a third-party library.</p>