From: "Radosław Bułat" Date: 2008-11-29T19:42:09+09:00 Subject: [ruby-core:20162] Re: \Z? in regular expression in 1.9.1 On Sat, Nov 29, 2008 at 12:14 AM, Michael Klishin wrote: > I noticed that the following reg exp causes syntax error in 1.9.1 (I use tip > of the branch): > > /\n(\.\/)?(.*spec\.rb):[\d]+:\Z?/ > > To reproduce, just fire up irb of 1.9.1 and try to assign this literal to > some variable. > > The problem is with ? quantifier following \Z. I could not find any > information about this > restriction on the web and have no Mastering regular expressions book at > hand. > > Could someone shed some light on whether it is 1.9.1 engine restriction, > general regular expressions > restriction or possible 1.9.1 bug? > > Just in case: this regexp comes from autospec in RSpec. I think this is expected behavior. "\Z" is zero width assertion so it doesn't make sense to mix it with "?" operator. Your regexp is the same as: /\n(\.\/)?(.*spec\.rb):[\d]+:/ -- Pozdrawiam Rados�aw Bu�at http://radarek.jogger.pl - m�j blog