Why do I get "xx" instead of "x" in the following:

$ irb
 >> 'test'.gsub(/.*/,'x')
=> "xx"

and even more confusing (to me):

 >> "x\n".gsub(/.*/,'y')
=> "yy\ny"

(I expected "y\n")
-- 
Wybo