[Contents]
[Prev]
[Next]
[Index]
[Report an Error]
Using Regular Expressions to Refine the Set of Events That
Cause a Policy to Be Executed
You can use regular expression matching to specify
more exactly which events cause a policy to be executed.
To specify the text string that must appear in
an event attribute for the policy to be executed, include the matches statement at the [edit event-options policy policy-name attributes-match] hierarchy
level, and specify the regular expression which the event attribute
must match:
- [edit event-options policy policy-name attributes-match]
-
event.attribute-name matches regular-expression;
When you specify the regular expression, use the
notation defined in POSIX Standard 1003.2 for extended (modern) UNIX
regular expressions. Explaining regular expression syntax is beyond
the scope of this document. Table 21 specifies
which character or characters are matched by some of the regular expression
operators that you can use in the matches statement. In the
descriptions, the term term refers to either
a single alphanumeric character or a set of characters enclosed in
square brackets, parentheses, or braces.
 |
Note:
The matches statement is not case-sensitive.
|
Table 21: Regular
Expression Operators for the matches Statement
|
Operator
|
Matches
|
|
. (period)
|
One instance of any character except the space.
|
|
* (asterisk)
|
Zero or more instances of the immediately preceding term.
|
|
+ (plus sign)
|
One or more instances of the immediately preceding term.
|
|
? (question mark)
|
Zero or one instance of the immediately preceding term.
|
|
| (pipe)
|
One of the terms that appear on either side of the pipe operator.
|
|
! (exclamation point)
|
Any string except the one specified by the expression, when
the exclamation point appears at the start of the expression. Use
of the exclamation point is specific to the JUNOS software.
|
|
^ (caret)
|
The start of a line, when the caret appears outside square brackets.
One instance of any character that does not follow it within
square brackets, when the caret is the first character inside square
brackets.
|
|
$ (dollar sign)
|
The end of a line.
|
|
[ ] (paired square brackets)
|
One instance of one of the enclosed alphanumeric characters.
To indicate a range of characters, use a hyphen ( - ) to separate the beginning and ending characters of the range. For
example, [a-z0-9] matches any letter or number.
|
|
( ) (paired parentheses)
|
One instance of the evaluated value of the enclosed term. Parentheses
are used to indicate the order of evaluation in the regular expression.
|
For a configuration example, see Controlling Event Policy Using a Regular Expression.
[Contents]
[Prev]
[Next]
[Index]
[Report an Error]