Understanding Regular Expressions; Special Characters; Multiple-Character Patterns - Cisco MDS 9000 Series Configuration Manual

Hide thumbs Also See for MDS 9000 Series:
Table of Contents

Advertisement

Understanding the Command-Line Interface

Understanding Regular Expressions

The Cisco NX-OS software supports regular expressions for searching and filtering in CLI output, such as
the show commands. Regular expressions are case sensitive and allow for complex matching requirements.

Special Characters

You can also use other keyboard characters (such as ! or ~) as single-character patterns, but certain keyboard
characters have special meanings when used in regular expressions.
This table lists the keyboard characters that have special meanings.
Table 8: Special Characters with Special Meaning
Character
.
*
+
?
^
$
_ (underscore)
To use these special characters as single-character patterns, remove the special meaning by preceding each
character with a backslash (\). This example contains single-character patterns that match a dollar sign ($),
an underscore (_), and a plus sign (+), respectively:
\$ \_ \+

Multiple-Character Patterns

You can also specify a pattern that contains multiple characters by joining letters, digits, or keyboard characters
that do not have special meanings. For example, a4% is a multiple-character regular expression.
With multiple-character patterns, the order is important. The regular expression a4% matches the character a
followed by a 4 followed by a percent sign (%). If the string does not have a4%, in that order, pattern matching
fails. The multiple-character regular expression a. (the character a followed by a period) uses the special
OL-29291-02
Special Meaning
Matches any single character, including white space.
Matches 0 or more sequences of the pattern.
Matches 1 or more sequences of the pattern.
Matches 0 or 1 occurrences of the pattern.
Matches the beginning of the string.
Matches the end of the string.
Matches a comma (,), left brace ({), right brace (}),
left parenthesis ( ( ), right parenthesis ( ) ), the
beginning of the string, the end of the string, or a
space.
Cisco MDS 9000 Family NX-OS Fundamentals Configuration Guide
Understanding Regular Expressions
55

Advertisement

Table of Contents
loading

Table of Contents