Project

General

Profile

This project is closed and read-only.

Actions

Backport #2508

closed

The {n} repetition notation issue in Regexp

Backport #2508: The {n} repetition notation issue in Regexp

Added by katz (katz bo) almost 17 years ago. Updated about 7 years ago.

Status:
Closed
[ruby-core:27247]

Description

=begin
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
=end

Actions

Also available in: PDF Atom