General

Profile

garethadams (Gareth Adams)

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 0 1 1

Activity

01/10/2012

02:06 AM Ruby Bug #5871: regexp \W matches some word characters when inside a case-insensitive character class
=begin
Thanks to investigation from #ruby-lang, It seems this issue only occurs with UTF-8 strings
ruby-1.9.2-p290> "KSks".encode("UTF-8").scan(/[\W]/i) != "KSks".encode("US-ASCII").scan(/[\W]/i)
=> true
=end
garethadams (Gareth Adams)
01:46 AM Ruby Bug #5871: regexp \W matches some word characters when inside a case-insensitive character class
I've now also seen at least one report that this doesn't affect 1.9.3p0 (win32)
garethadams (Gareth Adams)
01:40 AM Ruby Bug #5871: regexp \W matches some word characters when inside a case-insensitive character class
=begin
As a simpler test case:
> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".scan /[\W]/i
=> ["K", "S", "k", "s"] # should be []
=end
garethadams (Gareth Adams)
01:25 AM Ruby Bug #5871 (Rejected): regexp \W matches some word characters when inside a case-insensitive character class
=begin
The following replacement, which should do nothing, has removed the upper- and lower-case "K"s and "S"s from the result:
> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".gsub(/[\W]/i,"")
=> "ABCDEFGHIJLMNOPQRT...
garethadams (Gareth Adams)

Also available in: Atom