Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ruby Programming Language

I think this is a regexp bug


I'd greatly appreciate if anyone could explain what's up with this:

$KCODE='u'
 >> "" =~ //i
=> 0
 >> "" =~ /[]/i
=> 0
 >> " " =~ / /i
=> 0
 >> " " =~ /[ ]/i
=> nil

That has to be a bug, right?

Maybe this is a good opportunity to start looking at oniguruma. Is
anyone aware of backward compatibility issues when going from the
regular Regexp to oniguruma?

Daniel

On May 25, 2007, at 9:16 AM, Daniel DeLorme wrote:

> I'd greatly appreciate if anyone could explain what's up with this:

> $KCODE='u'
> >> "" =~ //i
> => 0
> >> "" =~ /[]/i
> => 0
> >> " " =~ / /i
> => 0
> >> " " =~ /[ ]/i
> => nil

> That has to be a bug, right?

I can't reproduce it:

fxn@feynman:~/tmp$ cat foo.rb
$KCODE = 'u'
puts "" =~ //i
puts "" =~ /[]/i
puts " " =~ / /i
puts " " =~ /[ ]/i
fxn@feynman:~/tmp$ ruby foo.rb
0
0
0
0
fxn@feynman:~/tmp$ ruby -v
ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin8.8.1]

Ah, silly me I forgot to test on different versions. It
happens on 1.8.4 but neither on 1.8.5 or 1.8.6

Thanks for the sanity check.

Daniel

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc