From: matt@... (matt neuburg) Date: 2009-05-28T23:15:10+09:00 Subject: Re: multiple matches Li Chen wrote: > I try #scan(pattern) but it doesn't return the > position for each match. I wonder how other handle this problem. It doesn't "return" the position but it does capture the position. s = 'ccccatgggctacatgggtcat' s.scan('cat') {puts Regexp.last_match.begin(0)} The last regex match is always hanging around waiting for you to ask about it.... Hope that helps - m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Leopard - http://www.takecontrolbooks.com/leopard-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com