On Dec 26, 8:53 am, "Marco" <marv... / tin.it> wrote:
> Hi, some newbie questions...
>
> 1) How can I obtain all the indices of the occurrences of a pattern in a
> string (and not only the index of the first one using "index")? And the
> index of the n-th occurrence?

Hi
perhaps you can find something useful in ruby core doc RegExp/
MatchData
it seems that the method offset is good for you

mtch.offset(n) => array

 Returns a two-element array containing the beginning and ending
offsets of the nth match.

Tom

>
> 2) What's the simplest way to select elements of a vector,on the basis of a
> condition on a second vector of the same length?
>
> Thanks,
>
>                       Marco