Joel VanderWerf wrote:
> class String
>   def all_indexes re
>     a=[];scan(re) {a<<$~.begin(0)};a
>   end
> end
> 
> p "foo bar baz".all_indexes(/.../)
> p "banana".all_indexes(/ana/)

and this variant counts overlaps:

p "banana".all_indexes(/(?=ana)/)

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407