title: Extract main domain name from a given url
body: <p>I used the following to extract the domain from a url: (They are test cases)</p>
  
  <pre><code>String regex = "^(ww[a-zA-Z0-9-]{0,}\\.)";
  ArrayList&lt;String&gt; cases = new ArrayList&lt;String&gt;();
  cases.add("www.google.com");
  cases.add("ww.socialrating.it");
  cases.add("www-01.hopperspot.com");
  cases.add("wwwsupernatural-brasil.blogspot.com");
  cases.add("xtop10.net");
  cases.add("zoyanailpolish.blogspot.com");
  
  for (String t : cases) {  
      String res = t.replaceAll(regex, "");  
  }
  </code></pre>
  
  <p>I can get the following results:</p>
  
  <pre><code>google.com
  hopperspot.com
  socialrating.it
  blogspot.com
  xtop10.net
  zoyanailpolish.blogspot.com
  </code></pre>
  
  <p>The first four cases are good. The last one is not good. What I want is: <code>blogspot.com</code> for the last one, but it gives <code>zoyanailpolish.blogspot.com</code>. What am I doing wrong?</p>