TechLibrary

Navigation Back up to About Overview

regmatch

Syntax

REGMATCH (attr, regex, groupingNumber)

Description

Match the regular expression pattern against an attribute and store the result in the custom variable.

Options

attr

System variable of type string.

regex

Quoted string containing the regular expression to be applied to the attr option.

groupingNumber

The group value to assign to the custom variable.

Additional Information

The regular expression supports the Perl Compatible Regular Expressions (PCRE) syntax. A grouping (capture buffer) in the regex pattern can also be used to define a custom variable.

Required Privilege Level

Output Fields

Returns a String value. If no match is found, returns an empty string.

If the system variable is multi-valued, the custom variable is also multi-valued and uses the same order as the system variable.

Sample Output

REGMATCH (mailId, “^(.*)@juniper.net$”, 1)

In this example, a mailId of myName@juniper.net creates a custom variable with value “myName”.

Published: 2012-10-04