From: Peter Bailey Date: 2008-04-09T21:22:25+09:00 Subject: Re: capitalizing words Todd Benson wrote: > On Tue, Apr 8, 2008 at 1:53 PM, Peter Bailey wrote: >> file.gsub(/^(.*)<\/emph>/) do |match| >> #(.*)<\/emph>theQuickBrownFoxJumpedOverTheLazyDog. >> >> I want this: >> >> The Quick Brown Fox Jumped Over The >> Lazy Dog.<\/emph>/ >> >> >> Thanks, >> Peter > > I don't know what the original text looks like in test1.txt, but this > might point you in the right direction... > > irb(main):001:0> s = "the quick brown fox" > => "the quick brown fox" > irb(main):002:0> s.split.map {|w| w.capitalize}.join ' ' > => "The Quick Brown Fox" > > Todd Thanks, Todd. The original text is just: THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.<\/emph>/ Should I just make your "s" equal to $1 from my original gsub? -Peter -- Posted via http://www.ruby-forum.com/.