From: Pit Capitain Date: 2005-10-19T20:08:59+09:00 Subject: Re: attaching code to run on regular expression match Eyal Oren schrieb: > So I would rather like to attach some code in a match directly, as one > does in parsing generators, e.g. > /(\w+:do_method):(\w+:do_other_method)/. > > Would something like that be possible in Ruby? I tried searching but > I'm not sure how such a feature would be called. I'm sure I'm missing something, but wouldn't this work: string.scan(/(\w+):(\w+)/) do |m1, m2| do_method(m1) do_other_method(m2) end Maybe you can show us one of your complex regex? Regards, Pit