From: Simon Strandgaard Date: 2004-06-11T05:24:59+09:00 Subject: Re: String#scan strangeness On Thursday 10 June 2004 18:49, Gennady wrote: > I am just wondering why String#scan "looses" a group in every match. I > would expect the following result: when using sub-captures, then #scan returns an array of sub-captures. This does not include capture[0].. which is the full-match. "abcd".scan(/(.)(.)/) #=> [["a", "b"], ["c", "d"]] when not using sub-captures at all, then #scan returns only full-matches. "abcd".scan(/../) #=> ["ab", "cd"] -- Simon Strandgaard