# I think this is a regexp bug

**URL:** <https://www.ruby-forum.com/t/i-think-this-is-a-regexp-bug/105049>\
**Category:** Ruby\
**Created:** [May 25, 2007, 9:16am UTC](https://www.ruby-forum.com/t/i-think-this-is-a-regexp-bug/105049 "2007-05-25T09:16:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_DeLorme](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9d8465/32.png) [@Daniel\_DeLorme](https://www.ruby-forum.com/u/Daniel_DeLorme)\
**Post date:** [May 25, 2007, 9:16am UTC](https://www.ruby-forum.com/t/i-think-this-is-a-regexp-bug/105049/1 "2007-05-25T09:16:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Daniel\_DeLorme](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9d8465/32.png) [@Daniel\_DeLorme](https://www.ruby-forum.com/u/Daniel_DeLorme)\
**Post date:** [May 25, 2007, 10:11am UTC](https://www.ruby-forum.com/t/i-think-this-is-a-regexp-bug/105049/2 "2007-05-25T10:11:50Z")

</div>

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

> =\> 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]

---

<div class="post-metadata">

**Author:** ![Daniel\_DeLorme](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9d8465/32.png) [@Daniel\_DeLorme](https://www.ruby-forum.com/u/Daniel_DeLorme)\
**Post date:** [May 25, 2007, 1:53pm UTC](https://www.ruby-forum.com/t/i-think-this-is-a-regexp-bug/105049/3 "2007-05-25T13:53:32Z")

</div>

Xavier N. wrote:

> 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
