# Regexp anomalous behavior

**URL:** <https://www.ruby-forum.com/t/regexp-anomalous-behavior/130192>\
**Category:** IronRuby\
**Created:** [February 26, 2008, 8:54am UTC](https://www.ruby-forum.com/t/regexp-anomalous-behavior/130192 "2008-02-26T08:54:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rjberry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/34f0e0/32.png) [@rjberry](https://www.ruby-forum.com/u/rjberry)\
**Post date:** [February 26, 2008, 8:54am UTC](https://www.ruby-forum.com/t/regexp-anomalous-behavior/130192/1 "2008-02-26T08:54:57Z")

</div>

Consider following program (test.rb):

puts ‘aaabbbaaa’.match(‘aaa’).length  
puts ‘aaabbbaaa’.match(‘x’).length

With CRuby, the result or running is:

[08:49:31 ~] ruby test.rb  
1  
test.rb:2: undefined method `length’ for nil:NilClass (NoMethodError)

With IronRuby (revision 76):

[08:37:14 ~] rbx test.rb  
3  
0

I apologize if this is a well-known issue and already on some to-do list

Robert B.  
Software architect  
Napa Ltd  
Tammasaarenkatu 3, Helsinki FI-00180  
P.O.Box 470, Helsinki FI-00181

Tel. +358 9 22 813 1  
Direct. +358 9 22 813 611  
GSM +358 45 11 456 02  
Fax. +358 9 22 813 800

Email: removed\_email\_address@domain.invalid

> **[Home – NAPA](https://www.napa.fi/)**
>
> NAPA provides intelligent solutions for maritime industry: Software, Services and Data Analysis for Ship Design and Operation. We combine naval architecture, shipping and digital expertise to help maritime business make the decisions that matter.

---

<div class="post-metadata">

**Author:** ![rjberry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/34f0e0/32.png) [@rjberry](https://www.ruby-forum.com/u/rjberry)\
**Post date:** [February 26, 2008, 10:58pm UTC](https://www.ruby-forum.com/t/regexp-anomalous-behavior/130192/2 "2008-02-26T22:58:04Z")

</div>

Robert B.:

> With IronRuby (revision 76):
> 
> [08:37:14 ~] rbx test.rb  
> 3  
> 0

Sure looks like a bug. I opened a bug for it:  
[http://rubyforge.org/tracker/index.php?func=detail&aid=18407&group\_id=4359&atid=16798](http://rubyforge.org/tracker/index.php?func=detail&aid=18407&group_id=4359&atid=16798)

- John
