cl-ppcre:split question
Edi Weitz
edi at weitz.de
Thu Jul 2 19:32:02 UTC 2015
Not with SPLIT, but how about this?
CL-USER 1 > (ppcre:all-matches-as-strings "\\S+" " foo bar baz
frob ")
("foo" "bar" "baz" "frob")
On Thu, Jul 2, 2015 at 9:16 PM, Mark H. David <mhd at yv.org> wrote:
> The examples for cl-ppcre:split here
>
> http://weitz.de/cl-ppcre/#split
>
> include this tempting recipe:
>
> (split "\\s+" "foo bar baz
> frob")
>
> => ("foo" "bar" "baz" "frob")
>
> However,
>
> (split "\\s+" " foo bar baz
> frob")
>
> => ("" "foo" "bar" "baz" "frob")
>
> I.e., the result list includes an empty string as the first element if there are one or more whitespace characters at the beginning of the string.
>
> How can I get rid of the empty string at the beginning? Is there a regexp match for this that would work with split?
>
> Thanks,
>
> Mark
>
More information about the pro
mailing list