From: Eric Hodel Date: 2009-04-06T14:42:24+09:00 Subject: Re: Ruby 1.9.1 - invalid multibyte escape: /[\xC0-\xDF]/ (RegexpError) On Apr 4, 2009, at 12:40, Iņaki Baz Castillo wrote: > Hi, using TreeTop parser I had a grammar defined working in Ruby1.8 > but it > fails in 1.9.1: > > ~# ruby1.8 -e "Regexp.new('[\xC0-\xDF]')" > OK > > ~# ruby1.9 -e "Regexp.new('[\xC0-\xDF]')" > -e:1:in `initialize': invalid multibyte escape: /[\xC0-\xDF]/ > (RegexpError) > > I've found the following text about differences between 1.8 and 1.9: > > "It is more rigorous that 1.8 when it comes to detecting invalid > code. For > example, 1.8 accepts /[^\x00-\xa0]/u, while 1.9 complains of invalid > multibyte > escape" > > Ok, so how should I write the above Regexp to work on 1.9.1? Regexp.new '[\xC0-\xDF]', nil, 'n'