From: Aaron Patterson Date: 2009-09-04T09:49:25+09:00 Subject: Re: Oniguruma: Different result in ruby 1.9.1 and 1.8.7 On Sep 3, 2009, at 5:33 PM, Miguel Teixeira wrote: > Hi, > > 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? > > I also tried to substitute ?\'name1\' with ? That expression is rather long. Have you tried reducing the regular expression to the smallest possible case that will make it break? --- Aaron Patterson http://tenderlovemaking.com