Bug #2508: The {n} repetition notation issue in Regexp
http://redmine.ruby-lang.org/issues/show/2508

Author: katz bo
Status: Open, Priority: Normal
Category: core
ruby -v:  ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]

There seems to be a bug in Ruby 1.9 regarding Regular Expression:

/(io){1}x/ =~ 'ioiox' # => 2 #fine
/(io){2}x/ =~ 'ioiox' # => nil #should be 0
/(io){2,2}x/ =~ 'ioiox'# => nil #should be 0
#below are correct
/(?:io){2}x/ =~ 'ioiox' # => 0
/(io){2}/ =~ 'ioiox' # => 0
/(io){2,}x/ =~ 'ioiox' # => 0
/(io){,2}x/ =~ 'ioiox' # => 0


----------------------------------------
http://redmine.ruby-lang.org