How can you parse a sub-domain (e.g. www.google.com) and determine the domain (e.g. google.com) from it? I've tried suggestions starting from regex to parsing it manually, but there are no clear rules. So now what? Well, there are lists of 1st level domains and 2nd level domains all over the net, browsers use them to determine which domain you can put cookies on, lets say you have your domain by the name of mydomain.com, you have many websites such as site1.mydomain.com and site2.mydomain.com but you want to share cookies between them, you can set...