k = conds.each do |key, value| index = msg.split.find_index { |e| e.match value } break [key, index] if index end