From: Paul Rubel Date: 2003-07-22T22:06:18+09:00 Subject: Re: gsub(/\s*$/, "") doubling string Hello, Yukihiro Matsumoto writes: > Hi, > > In message "Re: gsub(/\s*$/, "") doubling string" > on 03/07/22, ts writes: > > |P> # very odd (at least to me) in 1.8.0p3 > |P> irb(main):005:0> " TEST .".gsub(/\s*$/, "") > |P> => " TEST . TEST ." > | > | Can you try this > > Thank you for the fix, Guy. And thank you for finding a bug, Paul. Thank you for all your hard work and wonderful language. > |P> irb(main):002:0> " string ".gsub(/\s*$/, 'P') > |P> " stringPP" > | > | this is normal > > The first try replaces all trailing spaces with "P", then second try > replaces empty at the end of string with "P". Ah ha. That makes sense. My least surprise is now the same as yours. thank you, Paul