title: two-way search with Hashes?
body: <p>I'm trying to make a database search program using a Hash as my db storage.</p>
  
  <p>I can already search the list using member numbers but how would I search using fragments of numbers (so entering <code>1</code> would give you <code>001</code>, <code>010</code>, <code>011</code>, <code>021</code>, etc...) or fragmented/full usernames (Entering <code>ni</code> would give <code>Nightc||ed</code> and <code>Oni</code>)</p>
  
  <p>my current code is as follows:</p>
  
  <pre><code>#rDB by Nightc||ed, ©2015
  db = Hash.new()
  
  db["001"] = "Oni"
  db["002"] = "Eclipse"
  db["003"] = "Saikou"
  db["004"] = "Nightc||ed"
  db["005"] = "Anime"
  db["006"] = "Master"
  
  x = 0
  num = db.count
  
  puts "IN:   Member:"
  num.times do |pair|
      puts "#{db.keys[x]} | #{db.values[x]}"
      x += 1
  end
  
  puts "-------------------
  Enter index number:"
  i = gets.to_i
  i -= 1
  system "cls"
  puts "IN:   Member:
  #{db.keys[i]} | #{db.values[i]}"
  sleep
  </code></pre>