Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


split() Function (SLAX and XSLT)


SLAX Syntax

XSLT Syntax


Split a string into an array of substrings delimited by a regular expression pattern. If the optional integer argument limit is specified, the function splits the entire string into limit number of substrings. If there are more than limit number of matches, the substrings include the first limit-1 matches as well as the remaining portion of the original string for the last match.

The prefix associated with the namespace URI should be defined in the prefix-to-namespace mapping in the style sheet.



Regular expression pattern used as the delimiter.


(Optional) Number of substrings into which to break the original string.


Original string.

Return Value


Array of limit number of substrings. If limit is not specified, the result array size is equal to the number of substrings extracted from the original string as determined by the specified delimiter.

Usage Examples

In the following example, the original string is "123:abc:456:xyz:789". The jcs:split() function breaks this string into substrings that are delimited by the regular expression pattern, which in this case is a colon(:). The optional parameter limit is not specified, so the function returns an array containing all the substrings that are bounded by the delimiter(:).


The following example uses the same original string and regular expression as the previous example, but in this case, the optional parameter limit is included. Specifying limit=2 causes the function to return an array containing only two substrings. The substrings include the first match, which is "123" (the same first match as in the previous example), and a second match, which is the remaining portion of the original string after the first occurrence of the delimiter.


Release Information

Function introduced in Junos OS Release 8.4

Support for the slax namespace added in Junos OS Release 12.2.