katz
1
irb(main):113:0> /l{2}x/ =~ 'llx'
=> 0
irb(main):109:0> /(lo){2}/ =~ 'lolo'
=> 0
irb(main):110:0> /(lo){2}x/ =~ 'lolox'
=> nil
irb(main):111:0> /(?:lo){2}x/ =~ 'lolox'
=> 0
Note the third command returned nil but the fourth worked, any ideas?
$ ruby -v
ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]
katz
2
Katz Bo wrote:
Note the third command returned nil but the fourth worked, any ideas?
$ ruby -v
> ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]
irb(main):001:0> /(lo){2}x/ =~ ‘lolox’
=> 0
irb(main):002:0> RUBY_VERSION
=> “1.8.7”
katz
3
On Sun, Dec 20, 2009 at 10:05 AM, W. James [email protected] wrote:
=> 0
[/code]
Note the third command returned nil but the fourth worked, any ideas?
Seems like a bug.
irb(main):110:0> /(lo){2,3}x/ =~ ‘lolox’
irb(main):110:0> /(lo){1,2}x/ =~ ‘lolox’
irb(main):110:0> /(lo){2,}x/ =~ ‘lolox’
irb(main):110:0> /(lo){,2}x/ =~ ‘lolox’
all work for me on ruby 1.9.1p243 (2009-07-16 revision 24175)
[i386-mingw32]
It’s just {2} that doesn’t work.
–
Paul S.
http://www.nomadicfun.co.uk
[email protected]
katz
4
Paul S. wrote:
Seems like a bug.
It’s just {2} that doesn’t work.
Same for me. I actually had tried what you tried too. Also, {2,2} won’t
work either.
katz
5
On 20.12.2009 12:37, Katz Bo wrote:
Katz Bo wrote:
Same for me. I actually had tried what you tried too. Also, {2,2} won’t
work either.
Sorry for double posting, post too quick.
Yet another thing is, {1} works:
/(lo){1}x/ =~ ‘lololox’ # => 4
/(lo){2}x/ =~ ‘lololox’ # => nil
/(lo){3}x/ =~ ‘lololox’ # => nil
That’s definitively a bug! => http://redmine.ruby-lang.org/
Kind regards
robert
katz
6
Katz Bo wrote:
Same for me. I actually had tried what you tried too. Also, {2,2} won’t
work either.
Sorry for double posting, post too quick.
Yet another thing is, {1} works:
/(lo){1}x/ =~ ‘lololox’ # => 4
/(lo){2}x/ =~ ‘lololox’ # => nil
/(lo){3}x/ =~ ‘lololox’ # => nil