From: Daniel DeLorme Date: 2007-11-02T00:33:09+09:00 Subject: Re: String#split and groups in the field separator RE Daniel Sheppard wrote: >> Is this expected behaviour? I haven't seen anything related to this >> mentioned in the API docs... >> >> irb(main):060:0> s.split(/(:)+/) >> => ["a", ":", "b", ":", "c", ":", "d"] > > Yes, any capture groups in the regex will be included in the split > array. If you want to use groups without capturing it into the split > array, use a non-capturing group - ie, /(?=,)/ rather than /(,)/ /(?=,)/ is a lookahead match. I'm sure you really meant /(?:,)/