[posted & mailed]

On Feb 6, Steve Tuckner said:

>This would be very interesting and a way to play with RegExp's in Ruby in
>ways that you currently can't. For example, I have wished for the following
>capability.
>
>"aab1db2ec5daaac3dc4e".scan(/((a+)(([bc])(\d)([de]))+)+/,
>	Proc.new {|s,t|  print "a=#{a},b=#{b},c=#{c}\n"},
>	Proc.new {|x,y,z| print "d=#{d},e=#{e},f=#{f}\n"})
>
>would result in:
>
>x=b,y=1,z=d
>x=b,y=2,z=e
>x=c,y=5,z=d
>s=aa,t=b1db2ec5d
>x=c,y=3,z=d
>x=c,y=4,z=e
>s=aaa,t=c3dc4e

Uh, I can't follow the correlation between the code and the
output.  You appear to be prepping for the use of s, t, x, y, and z, but
then you use a, b, c, d, e, and f.  And the printed output doesn't have
a= b=, c=, d=, e=, or f= in it anywhere.  Could you rethink the code and
try again?

In Perl, you can execute arbitrary code in a regex.

  "japhy" =~ /((.)(?{ print "<$2>" }))+/;
  # <j><a><p><h><y>

I guess that's not possible in Ruby?

-- 
Jeff "japhy" Pinyan      japhy / pobox.com      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.