From: Guillaume Cottenceau Date: 2001-09-14T06:27:52+09:00 Subject: [ruby-talk:21188] Re: variables in reg exp repetition Paul Rubel writes: > Hello, > I've been working on some code lately and have come upon some strange > behavior (at least I think so). > Is there a problem with variables in repetition in regexps? > > ruby 1.6.4 (2001-06-04) [i686-linux] > /bin/ruby> irb > irb(main):001:0> three = 3 > 3 > irb(main):002:0> 'aaa' =~ /[a]{3,3}/ > 0 > irb(main):003:0> 'aaa' =~ /[a]{three,three}/ > nil This deals with substitution of variables... irb(main):006:0> 'aaa' =~ /[a]{#{three},#{three}}/ 0 -- Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/