From: MikkelFJ Date: 2003-03-12T22:34:35+09:00 Subject: Re: scanning strings "ts" wrote in message news:200303121125.h2CBPWd09137@moulon.inra.fr... > >>>>> "Y" == YANAGAWA Kazuhisa writes: > > Y> Hmm, by the way, > Y> " abc def ghi ".split(/(\s+)/) > Y> yields > Y> ["", " ", "abc", " ", "def", " ", "ghi", " "] > > pigeon% ruby -e 'p " abc def ghi ".split(/(\s+)/, -1)' > ["", " ", "abc", " ", "def", " ", "ghi", " ", ""] > pigeon% Arrgh - now I see. I need to create a submatch: /(\+s)/, not /\s+/ I did use the -1 to handle border conditions. Mikkel