vendor2 = conds.map do |key, value| [ msg.split.find_index { |e| e.match value }, key ] end.find(&:first)