On Aug 23, 2005, at 8:49 PM, David Brady wrote:
>   # Loads the @board array from a string matching the example above.
>   def load(str)
>     line_num = 0
>     str.each_line do |line|
>       line.gsub! '+', ''
>       line.gsub! '-', ''
>       line.gsub! '|', ''
>       line.gsub! '  ', ' '
>       line.gsub! '_', '0'
>       line.strip!
>       if line.length > 0
>         l = line.split
>         fail "Line length was #{l.length}" unless l.length == 9
>         @board[line_num] = l.collect {|x| x.to_i}
>         line_num += 1
>       end
>     end
>
>     fail "Board is not valid." unless self.valid?
>   end

How about just:
numbers = str.scan( /[\d_]/ ).collect{ |char| char.to_i }
and then check to see if you got 81 numbers or not (and split them up  
into chunks of nine if you so desire).

If nothing else, how about:
line.gsub!( /[+| -]/, '' )