Capture domain and path from URL with regex
python, regex
Solution
As noted - this is a non griddy version: `https?:\/\/(.+?)(\/.*)`
Problem
I'm trying to write a regex that will capture the domain and path from a URL. I've tried: ``` https?:\/\/(.+)(\/.*) ``` That works fine for http://example.com/foo: ``` Match 1 0. google.com 1. /foo ``` But not what I would expect for http://example.com/foo/bar: Expected: ``` Match 1 0. google.com 1. /foo/bar ``` Actual: ``` Match 1 0. google.com/foo 1. /bar ``` What am I doing wrong?