Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

regex() Function (SLAX and XSLT)

 

Namespaces

SLAX Syntax

XSLT Syntax

Release Information

Function introduced in Junos OS Release 7.6

Support for the slax namespace http://xml.libslax.org/slax added in Junos OS Release 12.2.

Description

Evaluate a regular expression against a given string argument and return any matches. This function requires two arguments: the regular expression and the string to which the regular expression is compared.

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

Parameters

patternRegular expression that is evaluated against the string argument.
stringString within which to search for matches of the specified regular expression.

Return Value

resultArray of strings that match the given regex pattern within the string argument.

Usage Examples

In the following example, the regex pattern consists of four distinct groups. The first group consists of the entire expression. The three subsequent groups are each of the parentheses–enclosed expressions within the main expression. The results for each jcs:regex() function call contain an array of the matches of the regex pattern to each of the specified strings.