D
Daniel Berger
Hi all,
As I was going through the accepted RCR's, came across
#43, which was accepted. This added the 'options()'
method for Regexp objects.
Testing this with 1.8 (2003-06-28) I immediately
noticed two things. First, flags to Regexp are
ignored, which I didn't know. Second, I'm confused as
to what is supposed to be returned.
# example using longhand
irb(main):001:0> r =
Regexp.new(/\w+/,Regexp::EXTENDED)
(irb):1: warning: flags ignored
=> /\w+/
# example using shorthand
irb(main):002:0> r.options
=> 0irb(main):003:0> r = /\w+/xi
=> /\w+/ix
irb(main):004:0> r.options
=> 3
My guess is that it's returning length + 1, instead of
the options themselves. If my opinion carries any
weight, I would like r.options (using the last
example) to return ["x","i"].
Is this a bug?
Regards,
Dan
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
As I was going through the accepted RCR's, came across
#43, which was accepted. This added the 'options()'
method for Regexp objects.
Testing this with 1.8 (2003-06-28) I immediately
noticed two things. First, flags to Regexp are
ignored, which I didn't know. Second, I'm confused as
to what is supposed to be returned.
# example using longhand
irb(main):001:0> r =
Regexp.new(/\w+/,Regexp::EXTENDED)
(irb):1: warning: flags ignored
=> /\w+/
# example using shorthand
irb(main):002:0> r.options
=> 0irb(main):003:0> r = /\w+/xi
=> /\w+/ix
irb(main):004:0> r.options
=> 3
My guess is that it's returning length + 1, instead of
the options themselves. If my opinion carries any
weight, I would like r.options (using the last
example) to return ["x","i"].
Is this a bug?
Regards,
Dan
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com