The library CL-PPCRE provides the function split
which allows us to split strings in substrings that match a regular expression, discarding the parts of the string that do not.
(cl-ppcre:split "\\." "127.0.0.1")
;; => ("127" "0" "0" "1")
Simple split of an IP number string.
> (lispworks:split-sequence "." "127.0.0.1")
("127" "0" "0" "1")
Simple split of an URL:
> (lispworks:split-sequence ".:/" "http://127.0.0.1/foo/bar.html"
:coalesce-separators t)
("http" "127" "0" "0" "1" "foo" "bar" "html")
The split-sequence library provides a function split-sequence
, which allows to split on elements of a sequence
(split-sequence:split-sequence #\Space "John Doe II")
;; => ("John" "Doe" "II")