需要使用正则表达式(使用PHP)来匹配域名。例子:正则表达式与域名匹配
http://sub.domain.com/somefolder/index.html -> domain.com
somedomain.info -> somedomain.info
http://anotherdomain.org/home -> anotherdomain.org
www.subdomain.anothersubdomain.maindomain.com/something/ -> maindomain.com
http://stackoverflow.com/questions/1236173/regexp-for-validating-au-domain-names和http://stackoverflow.com/questions/4963202/domain-regex -split – mario 2011-05-20 12:35:24