title: Using Regex, how can I pull out the top-level domain name?
body: <p>I need to create ONE efficient regular expression (least amount of backtracking) to pull out the top-level domain name from some logs.  The URL could be one of four types, so I need the following:</p>
  
  <ol>
  <li>extract <strong>website.ca</strong> in <strong>"website.ca/somepage"</strong></li>
  <li>extract <strong>website.com</strong> in <strong>"<a href="https://subdomain.website.com/somepage" rel="nofollow">https://subdomain.website.com/somepage</a>"</strong></li>
  <li>extract <strong>10.10.10.10</strong> in <strong>"10.10.10.10/somepage"</strong></li>
  <li>extract <strong>myserver</strong> in <strong>"myserver/somepage"</strong></li>
  </ol>
  
  <p>I have a semi-working solution, but it misses some.</p>
  
  <pre><code>"[^"]*(\w+\.[a-z]+|\d+\.\d+\.\d+\.\d+)\/
  </code></pre>
  
  <p>Anybody have any suggestions?</p>