Cisco Systems ASR 9000 manual Special Characters, Character Pattern Ranges, $ \ \+, a-dA-D, a-dqsv

Models: A9KMOD80TR A9K24X10GETR ASR 9000

1 142
Download 142 pages 58.88 Kb
Page 138
Image 138
Special Characters

Appendix A Understanding Regular Expressions, Special Characters, and Patterns

Special Characters

F I N A L D R A F T — C i s c o C o n f i d e n t i a l

Special Characters

Certain keyboard characters have special meaning when used in regular expressions. Table A-1lists the keyboard characters that have special meaning.

Table A-1

Characters with Special Meaning

 

 

 

Character

 

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.

 

 

 

_ (underscore)

 

Matches a comma (,), left brace ({), right brace (}), left parenthesis ( ( ), right

 

 

parenthesis ( ) ), the beginning of the string, the end of the string, or a space.

 

 

 

To use these special characters as single-character patterns, remove the special meaning by preceding each character with a backslash (\). In the following examples, single-character patterns matching a dollar sign, an underscore, and a plus sign, respectively, are shown.

\$ \_ \+

Character Pattern Ranges

A range of single-character patterns can be used to match command output. To specify a range of single-character patterns, enclose the single-character patterns in square brackets ([ ]). Only one of these characters must exist in the string for pattern-matching to succeed. 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 lowercase or uppercase alphabet.

Simplify a range of characters by entering only the endpoints of the range separated by a dash (–), as in the following example:

[a–dA–D]

To add a dash as a single-character pattern in the search range, include another dash and precede it with a backslash:

[a–dA–D\–]

A bracket (]) can also be included as a single-character pattern in the range:

[a–dA–D\–\]]

Invert the matching of the range by including a caret (^) at the start of the range. The following example matches any letter except the ones listed:

[^a–dqsv]

The following example matches anything except a right square bracket (]) or the letter d:

[^\]d]

Cisco ASR 9000 Series Aggregation Services Router Getting Started Guide

 

A-2

OL-17502-01

 

 

 

Page 138
Image 138
Cisco Systems ASR 9000, A9K24X10GETR, A9KMOD80TR manual Special Characters, Character Pattern Ranges, $ \ \+, a-dA-D, a-dqsv