From: Allan Date: 2010-03-03T12:45:05+09:00 Subject: Re: Find and replace with values from array with gsub I'm trying to debug this right now, but I'm hoping that I could use a lending hand: Input1: I am a big fan of Derek Jeter and Jorge Posada of the Yankees Output1: I am a big fan of Derek Jeter and Jorge Posada of the Yankees I am a big fan of Jorge Posada and Jorge Posada of the Yankees (all names have the proper links) I then switch the names around Input2: I am a big fan of Jorge Posada and Derek Jeter of the Yankees Output2: I am a big fan of Derek Jeter and Derek Jeter of the Yankees I am a big fan of Derek Jeter and Derek Jeter of the Yankees -A On Mar 2, 7:20 pm, Allan wrote: > Thanks for your help. I'm still seeing a small problem: > > My original input is: "I am a big fan of Derek Jeter and Jorge Posada > of the Yankees" > > Output is: I am a big fan of Derek Jeter and Jorge Posada of the > Yankees I am a big fan of Jorge Posada and Jorge Posada of the > Yankees > How do I fix that last loop to provide me with the correct return? > > Thanks in advance.  You've been a lot of help! > > -A > > On Mar 2, 6:54 pm, Raul Jara wrote: > > > Gah!  The last little bit should be: > > > names_links.each_pair do |name, link| > >    @full_text.gsub!(name, link) > > end > > > results is an array, not a hash, so it wouldn't make much sense to run > > each pair on it. > > > Sorry about that.  I really wish there were a way to edit posts. > > -- > > Posted viahttp://www.ruby-forum.com/. > >