From: mike leonard Date: 2008-03-22T03:05:01+09:00 Subject: Re: A question involving variable evaluation On Mar 21, 12:41 pm, Ravil Bayramgalin wrote: > just store a needed match position for every pattern and then use it like that: > > string = 'foobar' > patterns = [[/(oo)+(.*)/, 2], [/(.*)bar/, 1]] > p patterns.map {|regexp, position| string[regexp, position] } Well the idea is that users will be able to create new filters just by appending items to the array. For example, if you wanted to convert FOObar to fooBAR, you could do: patterns << [/(FOO)(bar)/, $~[0].downcase + $~[1].upcase] How would this work with your suggestion?