From: Robert Klemme Date: 2009-09-04T23:29:44+09:00 Subject: Re: Oniguruma: Different result in ruby 1.9.1 and 1.8.7 2009/9/4 Miguel Teixeira : > I have the following regular expression created in ruby 1.9.1: > > /(?:(?:\$(?'name1'[\w\s\']+)(?:(?'name2'(?:created|developed)[\w\s]+)(?name3'(?:in|at)[\w\s]+)))|(?:\$(?'name1'[\w\s\']+)(?'name2'(:?created|developed)[\w\s]+))|(?:\$(?'name1'[\w\s\']+)(?'name3'(?:in|at)[\w\s]+)))(?:\.(?'name4'[\w\s]+))?/.match(str) > > To use Oniguruma i have installed the following gem: > http://github.com/geoffgarside/oniguruma/tree/master > > (also tried with this solution: > http://www.goodbyehelicopter.com/2008/02/20/install-oniguruma-on-os-x/) > > After the installation of Oniguruma i have created the following regular > expression in ruby 1.8.7: > Oniguruma::ORegexp.new('(?:(?:\$(?\'name1\'[\w\s\']+)(?:(?\'name2\'(?:created|developed)[\w\s]+)(?\'name3\'(?:in|at)[\w\s]+)))|(?:\$(?\'name1\'[\w\s\']+)(?\'name2\'(:?created|developed)[\w\s]+))|(?:\$(?\'name1\'[\w\s\']+)(?\'name3\'(?:in|at)[\w\s]+)))(?:\.(?\'name4\'[\w\s]+))?').match(str) > > My problem is that the result in ruby 1.8.7 is different from the result > in 1.9.1. > Anyone has an idea about what's going on? What differences did you observe? Against which text did you match? To simplify your tests I would create both regular expressions via the string method. Then you can be sure to use the same string and not fall culprit of some conversion or typing errors. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/