From: Jens Wille Date: 2008-04-10T21:48:03+09:00 Subject: Re: capitalizing words 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