title: Capture domain and path from URL with regex
body: <p>I'm trying to write a regex that will capture the domain and path from a URL. I've tried:</p>
  
  <pre><code>https?:\/\/(.+)(\/.*)
  </code></pre>
  
  <p>That works fine for <a href="http://example.com/foo" rel="nofollow">http://example.com/foo</a>:</p>
  
  <pre><code>Match 1
  0.  google.com
  1.  /foo
  </code></pre>
  
  <p>But not what I would expect for <a href="http://example.com/foo/bar" rel="nofollow">http://example.com/foo/bar</a>:</p>
  
  <p>Expected:</p>
  
  <pre><code>Match 1
  0.  google.com
  1.  /foo/bar
  </code></pre>
  
  <p>Actual:</p>
  
  <pre><code>Match 1
  0.  google.com/foo
  1.  /bar
  </code></pre>
  
  <p>What am I doing wrong?</p>