I had a search and found lot's of similar regex examples, but not quite what I need.

I want to be able to pass in the following urls and return the results:

* **www.google.com** returns **google.com**
* **sub.domains.are.cool.google.com** returns **google.com**
* **doesntmatterhowlongasubdomainis.idont.wantit.google.com**
returns **google.com**
* **sub.domain.google.com/no/thanks** returns **google.com**

Hope that makes sense :)
Thanks in advance!-James