# File lib/universal_ruby_whois/server.rb, line 96
    def self.find_server_from_domain(domain)
      # valid domain?
      return nil unless domain =~ /^((?:[-a-zA-Z0-9]+\.)+[a-zA-Z]{2,})$/

      # start the searching.
      tld = nil
      parts = domain.split('.')

      # if the passed domain is more than two parts (. separated strings)
      # try to find the TLD from the last two parts (ie, .co.uk)
      if parts.size > 2
        tld_string = parts[-2,2].join('.')
        tld = self.list[tld_string]
      end

      # if nothing was found, check for a match on the last part only.
      if tld.blank?
        tld_string = parts.last
        tld = self.list[tld_string]
      end

      return nil if !tld.kind_of?(Whois::Server)
      return tld
    end