Regular Expressions

A regular expression is tool for mode matching. You should construct the matching mode based on certain rules, and then match the mode with the target object.

The regular expression is an expression that describes a set of strings. It consists of common characters (such as letters from "a" to "z") and particular characters (also named metacharacters). The regular expression is a template according to which you can search for the required string.

A regular expression can provide the following functions:

Formal Language Theory of the Regular Expression

The regular expression consists of common characters and particular characters.

Specifying a Filtering Mode in Command

NOTICE:

The VRP uses a regular expression to implement the filtering function of the pipe character. A display command supports the pipe character only when there is excessive output information.

When the output information is queried according to the filtering conditions, the first line of the command output starts with the information containing the regular expression.

The command can carry the parameter | count to display the number of matching entries. The parameter | count can be used together with other parameters.

For the commands supporting regular expressions, the three filtering methods are as follows:

NOTE:

The value of regular-expression is a string of 1 to 255 characters.

After the command output is filtered, the displayed information is displayed with its context. Context rules are as follows:
  • before before-line-number: displays lines that match filtering rules and the preceding before-line-number lines.

  • after after-line-number: displays lines that match filtering rules and the subsequent after-line-number lines.

  • before before-line-number + after after-line-number or after after-line-number + before before-line-number: displays lines that match filtering rules, the preceding before-line-number lines, and the subsequent after-line-number lines.
NOTE:

Values of before-line-number and after-line-number are a string of 1 to 999 characters.

Specify a Filtering Mode when Information is Displayed

When a lot of information is displayed, you can specify a filtering mode in the prompt "---- More ----".


Huawei Proprietary and Confidential
Copyright © Huawei Technologies Co., Ltd.