三本目 ダブルクオートで囲まれた数字に+1
str =####ここから %Q{HashMap map = new HashMap(); map.put("0", "zero"); map.put("1", "one"); map.put("2", "two"); map.put("3", "three"); map.put("10", "ten"); }###ここまで str.each do |line| if /"[0-9]*"/ =~ line then print $` num = $&[1...-1].to_i num = num+1 print '"' + num.to_s + '"' print $' else print line end end