Backport #7974

Case-insensitive group doesn't work in 2.0.0-p0

Added by Michael Granger about 1 year ago. Updated about 1 year ago.

[ruby-core:52963]
Status:Closed
Priority:Normal
Assignee:Tomoyuki Chikanaga

Description

=begin

A match group marked as case-insensitive (({(?i:...)})) fails to match if it occurs before a case-sensitive portion of the regex.

Given the script:

# -- syntax: ruby --
#encoding: utf-8

# Doesn't match in Ruby 2.0, but does in 1.9.3
p(/(?i:a) B/ =~ "A B")
p(/(?i:a) B/ =~ "a B")

# Matches in both versions
p(/(?i:a) B/i =~ "a b")
p(/(?i:a B)/ =~ "a B")
p(/(?i:a b)/ =~ "a B")
p(/B (?i:a)/ =~ "B A")
p(/B (?i:a)/ =~ "B a")

All cases match in Ruby 1.9.3p392:

$ ruby -v ~/temp/regroupi.rb
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.1]
0
0
0
0
0
0
0

but the first two don't match under Ruby 2.0.0p0:

$ ruby -v ~/temp/regroupi.rb
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]
nil
nil
0
0
0
0
0

I expected both versions to implement case-insensitive groups the same way.

=end

re_group_i.rb Magnifier - Minimal test case (211 Bytes) Michael Granger, 02/27/2013 08:03 AM

re_group_i.rb Magnifier - Minimal test case (285 Bytes) Michael Granger, 02/27/2013 08:24 AM

Associated revisions

Revision 39953
Added by Tomoyuki Chikanaga about 1 year ago

merge revision(s) 39547: [Backport #7972] [Backport #7974]

* Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757f
  v5.13.3 [Bug#7972] [Bug#7974]

History

#1 Updated by Michael Granger about 1 year ago

Updated version of test case script with better comments

#2 Updated by Yui NARUSE about 1 year ago

  • Status changed from Open to Closed

Fixed at r39547, thanks!

#3 Updated by Tomoyuki Chikanaga about 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport200
  • Status changed from Closed to Assigned
  • Assignee set to Tomoyuki Chikanaga

#4 Updated by Tomoyuki Chikanaga about 1 year ago

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

This issue was solved with changeset r39953.
Michael, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39547: [Backport #7972] [Backport #7974]

* Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757f
  v5.13.3 [Bug#7972] [Bug#7974]

Also available in: Atom PDF