From: 7rans Date: 2009-08-29T11:38:19+09:00 Subject: Re: I need a string#all_indices method--is there such a thing? On Aug 28, 4:25 am, timr wrote: > In ruby you can use string#index as follows: > str = "some text" > str.index(/t/) > =>5 > > But what if I want to get all the indices for a regex in the string? > Is there an string#all_indices method? A lot of solutions have been given here. It would be nice to see a test/benchmark matrix to compare them, if anyone is up to it.