From: kjana@...4lab.to (YANAGAWA Kazuhisa) Date: 2003-03-13T00:59:12+09:00 Subject: Re: scanning strings In message <200303121125.h2CBPWd09137@moulon.inra.fr> decoux@moulon.inra.fr 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% Yes, I searched and got the discussion on it from the ruby-list archive. At there incompatibility of Ruby and Perl on split (at that moment) was discussed and matz said "methods introduced from Perl like String#split should behave like so". # That threads is on October 1998, how far we've gone.... Then remaining question is why Perl by default discards empty fields at tail on split whereas preserved them at head, but that's another story :-P # Wow, I've completely forgotten the behavior of String#split given " " # (exact one space).... -- kjana@dm4lab.to March 13, 2003 Out of frying-pan, into the fire.