From: "Peña, Botp" Date: 2008-04-03T11:38:05+09:00 Subject: Re: confused by 'test'.gsub(/.*/,'x') From: Wybo Dekker [mailto:wybo@servalys.nl] # sure, that works, and so does test.gsub(/.+/,'x'). # The point is that I don't understand why test.gsub(/.*/,'x') gives me # 'xx', since .* means: zero or more of any character, except # the newline # character, i.e.: all of the string should be replaced with a # single x, as far as I can see. you can start (slowly) by comparing these two examples, irb(main):077:0> ''.gsub(/.*/, 'x') => "x" irb(main):078:0> ''.gsub(/.+/, 'x') => "" kind regards -botp