From: Peter Bailey Date: 2008-04-10T23:20:56+09:00 Subject: Re: capitalizing words Jens Wille wrote: > Peter Bailey [2008-04-10 14:26]: >> Do I do a "require oniguruma" at the top of my script? > sure. but you really don't need it to solve your task at hand. > > it's just the new regexp engine for ruby 1.9 and sometimes i like to > do some stuff with it that the default engine of 1.8 can't do > (zero-width look-behind in this case). > > you can still simplify your substitution by using the look-ahead > (which 1.8 *does* understand), so you get rid of the third capture: > > file.gsub(%r{^( > face="b">)(.*)(?=<\/emph>)}m) { > "#{$1}#{$2.gsub(%r{\b\w+\b}) { |w| w.capitalize }}" > } > > cheers > jens Thanks. But, again, do I need to do a "require" for oniguruma at the top? Cheers, Peter -- Posted via http://www.ruby-forum.com/.