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