title: Regex to parse sub domain and domain into separate groups
body: <p>I have the following possible inputs:</p>
  
  <pre><code>http://subdomain.domain.com/hello.html
  http://subdomain.domain.com
  https://subdomain.domain.com
  subdomain.domain.com
  http://domain.com/hello.html
  http://domain.com
  https://domain.com
  domain.com
  </code></pre>
  
  <p>I am trying to create a regular expression that will capture and subdomain into one group and domain into another group. So given the examples above I would get the following matches:</p>
  
  <pre><code>Sub Domain Group    Domain Group
  --------------------------------
  subdomain           domain.com
  subdomain           domain.com
  subdomain           domain.com
  subdomain           domain.com
  empty               domain.com
  empty               domain.com    
  empty               domain.com
  empty               domain.com
  </code></pre>