Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Using Regular Expressions

On the View Events page, you can filter the events displayed by the text in the event description. In the Description box, you can use regular expressions to filter and display a set of messages for viewing. Junos OS supports POSIX Standard 1003.2 for extended (modern) UNIX regular expressions.

Table 1 specifies some of the commonly used regular expression operators and the terms matched by them. A term can match either a single alphanumeric character or a set of characters enclosed in square brackets, parentheses, or braces.

Note: On the View Events page, the regular expression matching is case-sensitive.

Table 1: Common Regular Expression Operators and the Terms They Match

Regular Expression Operator

Matching Terms

. (period)

One instance of any character except the space.

For example, .in matches messages with win or windows.

* (asterisk)

Zero or more instances of the immediately preceding term.

For example, tre* matches messages with tree, tread, or trough.

+ (plus sign)

One or more instances of the immediately preceding term.

For example, tre+ matches messages with tree or tread but not trough.

? (question mark)

Zero or one instance of the immediately preceding term.

For example, colou?r matches messages with or color or colour.

| (pipe)

One of the terms that appear on either side of the pipe operator.

For example, gre|ay matches messages with either grey or gray.

! (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 Junos OS.

^ (caret)

The start of a line, when the caret appears outside square brackets.

For example, ^T matches messages with This line and not with On this line.

$ (dollar sign)

Strings at the end of a line.

For example, :$ matches messages with the following: and not with 2:00.

[] (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, [0-9] matches messages with any 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 example, dev(/|ice) matches messages with dev/ or device.

Published: 2013-08-14

Published: 2013-08-14