From: Jack Smith Date: 2008-10-02T05:56:50+09:00 Subject: Re: simple gsub method I take that back Stefano....you solved it for me! I forgot to add the x.gsub! ....when I did, my script is working. thanks a REAL lot for helping me with this! j Jack Smith wrote: > It does help Stefano as I had forgotton about \n so thanks for that but > my script still does not match on my "a" value even with the chomp > method added. > > > > > Stefano Crocco wrote: >> Alle Wednesday 01 October 2008, Jack Smith ha scritto: >>> j = gets >>> puts "enter replacer word: " >>> h = gets >>> >>> replacer(j, h) >>> >>> Can someone help me determine why gsub can't match my "a" value? >>> >>> thanks >> >> Strings returned by gets end in a newline, which doesn't exist in your >> string, >> so no match happens. To solve this, you can do >> >> j = gets.chomp >> >> and the same for h. >> >> I hope this helps >> >> Stefano -- Posted via http://www.ruby-forum.com/.