I want to be able to parse any url with ruby to get the main part of the domain without the www (just the XXXX.com)
www
Here's one that works better with .co.uk and .com.fr - type domains
domain = uri.host[/[^.\s\/]+\.([a-z]{3,}|([a-z]{2}|com)\.[a-z]{2})$/]