From: Daniel Sheppard Date: 2007-11-01T14:38:17+09:00 Subject: Re: String#split and groups in the field separator RE > 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 /(,)/ It is curious that it's not in the api doc... I must have learnt it from somewhere... Dan.