1-15
Catalyst 6500 Series Switch Command Reference—Release8.1
78-15474-01
Chapter1 Command-Line Interfac es Switch CLI
Multiple-Character Patterns
When creating regular expressions, you can also specify a pattern containing multiple characters. You
create multiple-character regular expressions by joini ng 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 wh en yo u want to r emove the ir spe cia l
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.
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 charac ters . These examples ar e all
valid regular expressions:
telebit 3107 v32bis
Multipliers
You can create more complex regular expressions to match multiple occurrences of a sp eci fied regula r
expression by using some special characters with your single- and multiple-ch aracter pat terns. Table 1-5
lists the special characters that specify “multiples” of a regular expression.
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 (*):
\**
Table1-5 Special Characters Used as Multipliers
Character Description
* Matches 0 or more single- or multiple-ch arac t er p at te rns.
+ Matches 1 or more single- or multiple-character pat te rns.
? Matches 0 or 1 occurrences of the single- or multiple-character patterns.