Tcl Package Commands


NAME

nresplit - Split a string into a proper Tcl list using a regular expression

SYNOPSIS

nresplit string ?regexp?

DESCRIPTION

Returns a list created by splitting string at each place that matches the regexp argument. Each element of the result list will consist of the characters from string that lie between instances of the text that matched regexp. The text that matched regexp is not included in the result list. Empty list elements will be generated if string contains adjacent matches of regexp, or if it matches the text at the start or end of string. If regexp is an empty string then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space characters (i.e. "@w").

See the nrematch man page for a description of regular expressions. Note that nresplit always turns on the p switch so all additional nre features are available by default.

This command is a super set of the standard split command. The only difference is that a regular expression is used as the splitter instead of a single set of characters.

KEYWORDS

list, nre, split, regular expression, string

Last change: 2.0

[ nre2.0 ]

Copyright © 1997 Darrel Schneider.