in reply to Re: Re: Not quite a simple split
in thread Not quite a simple split

I think you missed the '?' quantifier after the quoted-string group. It is allowed to be absent, so the split will accept whitespace alone. It also eats trailing whitespace after a quoted section.

The captured string between the quotes is the only element of the regex that is passed into the list result of split. If there is no quoted string, that capture is present, but undef. Hence the grep filter.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Re: Re: Not quite a simple split
by John M. Dlugosz (Monsignor) on Feb 02, 2004 at 05:23 UTC
    Actually, I missed the significance of a capture group in the split. So it returns the tokens which as I indicated will be everything except the quoted ones, but then the capture group makes it return the delimter too which will be the quoted strings.