On Wed, Apr 2, 2008 at 10:55 PM, Yossef Mendelssohn <ymendel / pobox.com> wrote: > On Apr 2, 3:35 pm, "Thomas Wieczorek" <wieczo... / googlemail.com> > wrote: > > > > > .* matches NO and ALL characters, so gsub() substitutes > > ''(empty)(=>'x') and and 'test'(=>'x') with x, so you get 'xx' > > That sounds like an explanation why ''.gsub(/.*/, 'x') is 'x' more > than why 'test'.gsub(/.*/, 'x') is 'xx'. It seems to me that the .* > should match [empty string]test[empty string] just once. > Yeah, it is confusing me, but I agreed on that explanation with myself, when I read it once here. I'd also expect 'x' instead of 'xx'