Project

General

Profile

Actions

Backport #2508

closed

The {n} repetition notation issue in Regexp

Added by katz (katz bo) almost 15 years ago. Updated over 5 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 #1

Updated by dblack (David Black) almost 15 years ago

=begin
Hi --

On Sun, 20 Dec 2009, katz bo wrote:

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

I would call this a severe bug.

David

--
David A. Black
Senior Developer, Cyrus Innovation Inc.
THE COMPLEAT RUBYIST, Ruby training with Black/Brown/McAnally!
January 22-23, Tampa, Florida
Info and registration at http://www.thecompleatrubyist.com

=end

Actions #2

Updated by naruse (Yui NARUSE) almost 15 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r26143.
katz, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions #3

Updated by naruse (Yui NARUSE) almost 15 years ago

  • Category set to core
  • Status changed from Closed to Assigned
  • Assignee set to shyouhei (Shyouhei Urabe)

=begin

=end

Actions #4

Updated by naruse (Yui NARUSE) almost 15 years ago

  • Assignee changed from shyouhei (Shyouhei Urabe) to yugui (Yuki Sonoda)

=begin

=end

Actions #5

Updated by jeremyevans0 (Jeremy Evans) over 5 years ago

  • Description updated (diff)
  • Status changed from Assigned to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0