From: Mike Gooding Date: 2002-05-30T05:25:06+09:00 Subject: Re: Regexp in ranges as control > lines.readlines("somefile").each do |line| > puts line if line === /start/../end/ > end > I believe that when using range equivalence (===) you have to put the range on the left hand side. I think you also have to enclose it in brackets, but since i've never tried it without them... So it would become something like lines.readlines("somefile").each do |line| puts line if (/start/../end/) === line end > > [1,2,3,4,5,6].each do |x| > puts x if x === 3..5 > end Also note that this -doesn't- work, because the operands are on the wrong sides of the range equivalence (and brackets -are- needed). puts x if (3..5) === x produces the correct output; 3\n4\n5\n puts x if x === 3..5 behaves like some twisted x == 3 statement. Funnily enough I encountered just this problem about 30 minutes ago ;) -Mike