From: "A. S. Bradbury" Date: 2006-09-10T21:10:37+09:00 Subject: Re: How about Enumerable#find_pattern? On Sunday 10 September 2006 13:03, dblack@wobblini.net wrote: > #find, yes, but #grep does something similar to what I understand you > to be describing: > > %w{a b c}.grep(/./) > => ["a", "b", "c"] > irb(main):002:0> str = "a\nb\nc" > => "a\nb\nc" > irb(main):003:0> str.grep(/./) > => ["a\n", "b\n", "c"] > I'm thinking this: foo=[1,2,3,4,5,6,5,4,3,2,1] foo.find_pattern(5,6,5) #=> 4 (position of the start of this pattern) Alex