From: James Edward Gray II Date: 2005-05-27T06:02:49+09:00 Subject: Re: Strange split with parentheses in Regexp On May 26, 2005, at 3:55 PM, Oliver Cromm wrote: > I just stumbled over the following effect and (trial-and error) > workaround: > > p "abcxyxyxydef".split(/(xy)+/) #=> ["abc","xy","def"] > p "abcxyxyxydef".split(/(?:xy)+/) #=> ["abc","def"] > > Why this difference? A capture in a split() Regexp is taken to indicate pieces of the separator you would like returned in the resulting set. Hope that helps. James Edward Gray II