On Oct 12, 2006, at 7:00 PM, Chris Meyers wrote:

> I am having trouble with the Ruby regexp engine and don't know if  
> it is
> my lack of experience with Ruby, or if it just isn't possible to do
> certain things with the Ruby engine.  Basically I have the following
> code in perl and C#, simplified for the example:
>
> Perl:
> $line = "banana";
> while( $line =~ /(an)*/g )
> {
>     print $`. "<<" . $& . ">>" . $' . "\n";
> }

scan() can also take a block:

"banana".scan { puts "#{$`}<<#{$&}>>#{$'}" }

James Edward Gray II