Cisco 4500M Command Reference Manual page 29

Command reference
Hide thumbs Also See for 4500M:
Table of Contents

Advertisement

Chapter1
Command-Line Interface
You can create a multiple-character regular expression containing all letters, all digits, all keyboard
characters, or a combination of letters, digits, and other keyboard characters. These examples are all
valid regular expressions:
telebit 3107 v32bis
Multipliers
You can create more complex regular expressions to match multiple occurrences of a specified regular
expression by using some special characters with your single- and multiple-character patterns.
lists the special characters that specify "multiples" of a regular expression.
Table1-5
Character
*
+
?
This example matches any number of occurrences of the letter a, including none:
a*
This pattern requires that at least one letter a in the string is matched:
a+
This pattern matches the string bb or bab:
ba?b
This string matches any number of asterisks (*):
\**
To use multipliers with multiple-character patterns, you enclose the pattern in parentheses. In the
following example, the pattern matches any number of the multiple-character string ab:
(ab)*
As a more complex example, this pattern matches one or more instances of alphanumeric pairs (but not
none; that is, an empty string is not a match):
([A-Za-z][0-9])+
The order for matches using multipliers (*, +, or ?) is to put the longest construct first. Nested constructs
are matched from outside to inside. Concatenated constructs are matched beginning at the left side of the
construct. Thus, the regular expression matches A9b3, but not 9Ab3 because the letters are specified
before the numbers.
Alternation
Alternation allows you to specify alternative patterns to match against a string. You separate the
alternative patterns with a vertical bar (|). Exactly one of the alternatives can match the string. For
example, the regular expression
codex | telebit
matches the string codex or the string telebit, but not both codex and telebit.
78-16201-01
Special Characters Used as Multipliers
Description
Matches 0 or more single- or multiple-character patterns.
Matches 1 or more single- or multiple-character patterns.
Matches 0 or 1 occurrences of the single- or multiple-character patterns.
Catalyst4500 Series SwitchCiscoIOS Command Reference—Release 12.2(18)EW
Using the CLI String Search
Table1-5
1-9

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ws-c4507r4500 series

Table of Contents