Cisco Catalyst 4500 Series Command Reference Manual page 54

Cisco ios command reference release ios xe 3.4.0sg and ios 15.1(2)sg
Hide thumbs Also See for Catalyst 4500 Series:
Table of Contents

Advertisement

Chapter 1
Command-Line Interface
Using the CLI String Search
You can specify a range of single-character patterns to match against command output. For example,
you can create a regular expression that matches a string containing one of the following letters: a, e, i,
o, or u. One and only one of these characters must exist in the string for pattern matching to succeed. To
specify a range of single-character patterns, enclose the single-character patterns in square brackets
([ ]). For example,
[aeiou]
matches any one of the five vowels of the lowercase alphabet, while
[abcdABCD]
matches any one of the first four letters of the lower- or uppercase alphabet.
You can simplify ranges by entering only the end points of the range separated by a dash (-). Simplify
the previous range as follows:
[a-dA-D]
To add a dash as a single-character pattern in your range, include another dash and precede it with a
backslash:
[a-dA-D\-]
You can also include a right square bracket (]) as a single-character pattern in your range. To do so, enter
the following:
[a-dA-D\-\]]
The previous example matches any one of the first four letters of the lower- or uppercase alphabet, a
dash, or a right square bracket.
You can reverse the matching of the range by including a caret (^) at the start of the range. This example
matches any letter except the ones listed:
[^a-dqsv]
This example matches anything except a right square bracket (]) or the letter d:
[^\]d]
Multiple-Character Patterns
When creating regular expressions, you can also specify a pattern containing multiple characters. You
create multiple-character regular expressions by joining letters, digits, or keyboard characters that do not
have special meaning. For example, a4% is a multiple-character regular expression. Put a backslash in
front of the keyboard characters that have special meaning when you want to remove their special
meaning.
With multiple-character patterns, order is important. The regular expression a4% matches the character
a followed by a 4 followed by a % sign. If the string does not have a4%, in that order, pattern matching
fails. This multiple-character regular expression:
a.
uses the special meaning of the period character to match the letter a followed by any single character.
With this example, the strings ab, a!, or a2 are all valid matches for the regular expression.
You can remove the special meaning of the period character by putting a backslash in front of it. In the
following expression:
a\.
only the string a. matches this regular expression.
Catalyst 4500 Series Switch Cisco IOS Command Reference—Release IOS XE 3.4.0SG and IOS 15.1(2)SG)
1-8
OL-27596 -01

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents