From: Brian Adkins Date: 2008-11-12T02:47:35+09:00 Subject: Re: Comparing variable to multiple values Robert Klemme writes: > On 11.11.2008 01:56, Brian Adkins wrote: >> puts 'good' if a =~ /word[1-3]/ >> >> or >> >> puts 'good' if a =~ /word\d+/ > > You forgot the anchors. Your regexp will also match "fooword1bar" > which was not intended by OP. Also, IIRC it is more efficient to > switch sides, i.e. Interesting - I wouldn't think there would be a difference, but I just benchmarked it and it appears that putting the pattern on the left gives a 1.2% speed boost. -- Brian Adkins http://www.lojic.com/ http://lojic.com/blog/