# File lib/sup/person.rb, line 74
  def self.from_address s
    return nil if s.nil?

    ## try and parse an email address and name
    name, email = case s
      when /(.+?) ((\S+?)@\S+) \3/
        ## ok, this first match cause is insane, but bear with me.  email
        ## addresses are stored in the to/from/etc fields of the index in a
        ## weird format: "name address first-part-of-address", i.e.  spaces
        ## separating those three bits, and no <>'s. this is the output of
        ## #indexable_content. here, we reverse-engineer that format to extract
        ## a valid address.
        ##
        ## we store things this way to allow searches on a to/from/etc field to
        ## match any of those parts. a more robust solution would be to store a
        ## separate, non-indexed field with the proper headers. but this way we
        ## save precious bits, and it's backwards-compatible with older indexes.
        [$1, $2]
      when /["'](.*?)["'] <(.*?)>/, /([^,]+) <(.*?)>/
        a, b = $1, $2
        [a.gsub('\"', '"'), b]
      when /<((\S+?)@\S+?)>/
        [$2, $1]
      when /((\S+?)@\S+)/
        [$2, $1]
      else
        [nil, s]
      end

    Person.new name, email
  end