From: Pavel Pvl Date: 2007-12-31T02:18:10+09:00 Subject: Re: sub is odd with # > First of all, I think what you see is not a '/' but a '\'. > > I don't think the \ is part of the returned string. I assume you're > trying > this in irb. irb displays the return value of every expression using its > inspect method. String#inspect escapes some characters, such as double > quotes > and the # character, when it would be interpreted as the beginning of > string > interpolation. Since "#@" is the beginning of a string interpolation, it > gets > escaped. If you do a puts '@@@@'.sub('@','#'), or examine the first > element > of the returned string, you'll see that the returned string is correct. d by String#inspect. > Stefano thanks for all the replies! but this was true, i tried it with puts and it came out normal. TY!!! -- Posted via http://www.ruby-forum.com/.