From: Caleb Clausen Date: 2010-04-14T02:27:42+09:00 Subject: Re: How to find multiple matches in a string On 4/13/10, Alex DeCaria wrote: > Andrea Dallera wrote: >> Hei, >> >> s = 'abcde_abcde_abcde' >> m = s.scan(/b/) >> p m # ['b','b','b'] >> >> HTH > > Thanks Andrea. But is there a way to also find the locations (indexes) > of the 'b' characters? I think this works: s = 'abcde_abcde_abcde' i=0 while i=s.index('b',i) do_something_with i end