Issue #8023 has been updated by pietzcker (Tim Pietzcker).


More observations:

.+ works as does its equivalent {1,}, but only in Ruby 1.9 (it seems that that's the only behavioral difference between the two in this scenario):

pry(main)> "foo" =~ /(?<=fo).+/m
=> 2
pry(main)> "foo" =~ /(?<=fo).{1,}/m
=> 2
In Ruby 2.0:

irb(main):018:0> "foo" =~ /(?<=fo).+/m
=> nil
irb(main):019:0> "foo" =~ /(?<=fo).{1,}/m
=> nil
.{0,} is busted (in both 1.9 and 2.0):

pry(main)> "foo" =~ /(?<=fo).{0,}/m
=> nil
But {n,m} works in both:

pry(main)> "foo" =~ /(?<=fo).{0,1}/m
=> 2
pry(main)> "foo" =~ /(?<=fo).{0,2}/m
=> 2
pry(main)> "foo" =~ /(?<=fo).{0,9999}/m
=> 2
pry(main)> "foo" =~ /(?<=fo).{1,999}/m
=> 2
----------------------------------------
Bug #8023: Lookbehind assertion fails with /m mode enabled
https://bugs.ruby-lang.org/issues/8023#change-37324

Author: pietzcker (Tim Pietzcker)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p0 (2013-02-24) [x64-mingw32]


Lookbehind assertions fail if they are longer than one character, and if dotall mode is set.

irb(main):001:0> "foo" =~ /(?<=f).*/m
=> 1
irb(main):002:0> "foo" =~ /(?<=fo).*/m
=> nil

The latter should have matched the "o". This only seems to happen with dotall mode turned on (dot matches newline); without it, everything is OK:

irb(main):003:0> "foo" =~ /(?<=f).*/
=> 1
irb(main):004:0> "foo" =~ /(?<=fo).*/
=> 2


-- 
http://bugs.ruby-lang.org/