Search a value across 2 array
The orthodox (and functional) approach in Ruby is:

def find_type(types, str)
  types.detect do |type|
    type[:criteria].any? do |criterion|
      str =~ /#{criterion}/i # or Regexp.new(criterion, "i")
    end
  end
end