Robert Klemme wrote:
> But I though it will strip trailing empty strings - what about the leading
> empty string in my example?  I'd expect that to be preserved.
> 

Let take another example both with leading and tailing empty strings.

irb(main):005:0> '34ab34'.split(/\d+/, 10)
=> ["", "ab", ""]
irb(main):006:0> '34ab34'.split(/\d+/)
=> ["", "ab"]


When no limit are specified, Ruby wipes the tailing empty strings,
until it reaches a non-empty string.


In your case there are zero non-empty strings.. so Ruby wipes everything.

irb(main):001:0> 'ab'.split(/\D+/)
=> []
irb(main):002:0> 'ab'.split(/\D+/, 10)
=> ["", ""]


FYI:  I have no idea when this wiping empty tail elements are useful.
Any ideas ?

-- 
Simon Strandgaard