FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1. Moderate update since 8.1 release.
8.0 version

split-re

Arguments: regexp string &key count (start 0) end (return :string) case-fold single-line multiple-lines ignore-whitespace

This function scans string for a delimiter given by regexp and returns a list of substrings. If count is given, then split into no more than count substrings, in which case the last substring will contain the rest of the string. If start and end are specified, the who;e string is scanned but only delimiters between start (includive) and end (exclusive) are considered.

regexp should match a non-zero length string, or an error is signaled.

The return argument can be :string (the default, the return value will be a list of strings) or :index (the return value will be a list of dotted pairs or indexes into string corresponding to the substrings that would have been returned if return was :string). See the example.

See the section Matching mode in the regexp2 module in regexp.htm for information on the case-fold, single-line, multiple-lines, and ignore-whitespace keyword arguments.

The symbol naming this operator is also exported from the regexp package.

Examples

(excl:split-re "-" "a-b-c-d")
  --> ("a" "b" "c" "d")
(split-re ":" "1:2:3:4:5")
  --> ("1" "2" "3" "4" "5")
(split-re ":" "1:2:3:4:5" :return :index)
  --> ((0 . 1) (2 . 3) (4 . 5) (6 . 7) (8 . 9))
(split-re ":" "1:2:3:4:5" :count 2)
  --> ("1" "2" "3:4:5")
(split-re ":" "1:2:3:4:5" :start 2)
  --> ("1:2" "3" "4" "5")
(split-re ":" "1:2:3:4:5" :start 2 :return :index)
  --> ((0 . 3) (4 . 5) (6 . 7) (8 . 9))

cl-user(23): (split-re "/+" "abc/def")
("abc" "def")
cl-user(24): (split-re "/+" "/abc//def///ghi")
("" "abc" "def" "ghi")
cl-user(25): 

See The new regexp2 module in regexp.htm for further information on this function and the regexp2 module.


Copyright (c) 1998-2009, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.1. This page was not revised from the 8.0 page.
Created 2009.9.3.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1. Moderate update since 8.1 release.
8.0 version