I think this is a regexp bug

D

Daniel DeLorme

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
 
X

Xavier Noria

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

$KCODE=3D'u'
"=C3=A0" =3D~ /=C3=A0/i =3D> 0
"=C3=A0" =3D~ /[=C3=A0]/i =3D> 0
"=C4=81" =3D~ /=C4=81/i =3D> 0
"=C4=81" =3D~ /[=C4=81]/i
=3D> nil

That has to be a bug, right?

I can't reproduce it:

fxn@feynman:~/tmp$ cat foo.rb
$KCODE =3D 'u'
puts "=C3=A0" =3D~ /=C3=A0/i
puts "=C3=A0" =3D~ /[=C3=A0]/i
puts "=C4=81" =3D~ /=C4=81/i
puts "=C4=81" =3D~ /[=C4=81]/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]
 
D

Daniel DeLorme

Xavier said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,260
Messages
2,571,301
Members
47,945
Latest member
LaverneBas

Latest Threads

Top