Information Technology Reference
In-Depth Information
Regular Expression Matches AS_PATH Patterns
Example 4-2
ip as-path access-list permit ^(100_)+$
Components of a Regular Expression
A regular expression consists of two types of characters:
Characters to be matched, or regular characters
Control characters or metacharacters that have special meanings
To really make good use of regular expressions, it is critical to understand the control
characters and how they are used. Control characters can be grouped into three types:
Atom characters, or atoms —An atom is an independent control character or
placeholder character that defines or expands the regular characters that are before or
after it. Some atoms can be standalone, without regular characters.
Multiplier characters, or multipliers —A multiplier follows an atom or a regular
character and is used to describe repetitions of the character immediately before it.
Except for the dot (.) character, all other atom characters must be grouped with regular
characters before a multiplier is appended.
Range characters —Range characters (brackets) specify a complete range.
Table 4-1 lists the common atom characters.
Table 4-1 Common Atom Characters and Their Usage
Atom Character
Usage
.
Matches any single character, including white space.
^
Matches the beginning character of a string.
$
Matches the ending character of a string.
_
Underscore. Matches a comma (,), left brace ({), right brace (}), the
beginning of an input string, the end of an input string, or a space.
|
Pipe. It is an OR, meaning that it matches either of two strings.
\
An escape character to turn a control character that immediately follows
into a regular character.
Some simple examples are listed in Table 4-2.
 
Search WWH ::




Custom Search