takes www.yourdomain.com and return and array of three parts www yourdomain.com yourdomain
in javascript I use it like this: var reDomainName = /^(.?).?(([^.])(?:(?:..{2,3})|(?:(?:..{2,3})(?:..{2}))))$/; var aDomainName = sDomain.match( reDomainName ) || ["","",""];