cl-ppcre:split question

Mark H. David mhd at yv.org
Thu Jul 2 19:16:55 UTC 2015


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