1. irb(main):006:0> arr = {"test" => "blah", "102" => "hello"}
  2. => {"102"=>"hello", "test"=>"blah"}
  3. irb(main):007:0> "102 test".gsub(/(\d+)/) {|m| arr[$1] }
  4. => "hello test"