From: Bill Kelly Date: 2005-12-15T11:05:02+09:00 Subject: Re: regular expressions question Hi, From: "ako..." > >i give up. there seems to be no way to get all the captures for a > group. the corresponding $ variable just has the last one. Could you help us to understand why #scan didn't meet your needs? Called without a block, #scan returns an array of matches: >> "abc--------abc--------abc".scan(/(a)(b)(c)/) => [["a", "b", "c"], ["a", "b", "c"], ["a", "b", "c"]] Called with a block, #scan calls your block each time a match is found: >> "abc--------abc--------abc".scan(/(a)(b)(c)/) { puts "#$1, #$2, #$3" } a, b, c a, b, c a, b, c Hope this helps, Bill