1
Introduction
The following pattern requires that at least one letter a be in the string to be
matched:
a+
The following pattern matches the string bb or bab:
ba?b
The following string matches any number of asterisks (*):
\**
To use multipliers with multiple-character patterns, enclose the pattern in
parentheses. In the following example, the pattern matches any number of the
multiple-character string ab:
(ab)*
The following 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 above 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 (| ) . Only one of the alternatives
can match the string. For example, the regular expression codex|telebit either
matches the string codex or the string telebit, but not both codex and telebit.
45
Cisco Sx350 Ph. 2.2.5 Devices - Command Line Interface Reference Guide