Forum: Ruby-core [ruby-trunk - Bug #7974][Open] Case-insensitive group doesn't work in 2.0.0-p0

Posted by Michael Granger (michael_g71)
on 2013-02-27 00:03
(Received via mailing list)
Issue #7974 has been reported by ged (Michael Granger).

----------------------------------------
Bug #7974: Case-insensitive group doesn't work in 2.0.0-p0
https://bugs.ruby-lang.org/issues/7974

Author: ged (Michael Granger)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]


=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/re_group_i.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/re_group_i.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
Posted by Michael Granger (michael_g71)
on 2013-02-27 00:24
(Received via mailing list)
Issue #7974 has been updated by ged (Michael Granger).

File re_group_i.rb added

Updated version of test case script with better comments
----------------------------------------
Bug #7974: Case-insensitive group doesn't work in 2.0.0-p0
https://bugs.ruby-lang.org/issues/7974#change-37120

Author: ged (Michael Granger)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]


=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/re_group_i.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/re_group_i.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
Posted by naruse (Yui NARUSE) (Guest)
on 2013-03-11 04:26
(Received via mailing list)
Issue #7974 has been updated by naruse (Yui NARUSE).

Status changed from Open to Closed

Fixed at r39547, thanks!
----------------------------------------
Bug #7974: Case-insensitive group doesn't work in 2.0.0-p0
https://bugs.ruby-lang.org/issues/7974#change-37488

Author: ged (Michael Granger)
Status: Closed
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]


=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/re_group_i.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/re_group_i.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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.