From: Andrei Kulakov Date: 2010-08-12T01:09:13+09:00 Subject: [ruby-core:31677] [Backport #3681] Character class abbreviations, + repetition notation and group backreferences issue in Regexp Backport #3681: Character class abbreviations, + repetition notation and group backreferences issue in Regexp http://redmine.ruby-lang.org/issues/show/3681 Author: Andrei Kulakov Status: Open, Priority: Normal There seems to be a bug in Ruby 1.9.2 rc2 regarding Regular Expression /([A-Z][a-z]+){2}/ =~ 'TestString' # => 0 #correct /([A-Z]\w+){2}/ =~ 'TestString' # => nil #should be 0 /([A-Z](\w)+){2}/ =~ 'TestString' # => 0 #correct /([A-Z](?:\w)+){2}/ =~ 'TestString' # => nil #should be 0 /([A-Z]\w{1,10}){2}/ =~ 'TestString' # => 0 #correct /([A-Z]\w{1,}){2}/ =~ 'TestString' # => nil #should be 0 Ruby 1.9.1 p429 yields correct result /([A-Z][a-z]+){2}/ =~ 'TestString' # => 0 #correct /([A-Z]\w+){2}/ =~ 'TestString' # => 0 #correct /([A-Z](\w)+){2}/ =~ 'TestString' # => 0 #correct /([A-Z](?:\w)+){2}/ =~ 'TestString' # => 0 #correct /([A-Z]\w{1,10}){2}/ =~ 'TestString' # => 0 #correct /([A-Z]\w{1,}){2}/ =~ 'TestString' # => 0 #correct ---------------------------------------- http://redmine.ruby-lang.org