Literals and Metacharacters

 

A typical AS_PATH filter might look like this:

  ip as-path access-list 83 permit ^1_701  _(  _5646_   _1240_  )  .*  

The string of characters following the permit keyword is a regular expression. The regex is composed of literals and metacharacters. Literals are just text characters that describe what the regex will try to match. In this example, 1, 701, 5646, and 1240 are literals describing autonomous system numbers .

Metacharacters are special regular-expression characters that act as operators, telling the regex how to perform matches. Table B-1 shows the metacharacters available for use with Cisco IOS; the remainder of this appendix describes how each of the metacharacters are used.

Table B-1. Regular-Expression Metacharacters Relevant to AS_PATH Access Lists
Metacharacter What It Matches
. Any single character, including white space.
[] Any character listed between the brackets.
[^] Any character except those listed between the brackets. (The caret is placed before the sequence of literals.)
- (Hyphen) Any character in the range between the two literals separated by the hyphen.
? Zero or one instances of the character or pattern.
* Zero or more instances of the character or pattern.
+ One or more instances of the character or pattern.
^ Start of a line.
$ End of a line.
Either of the literals separated by the metacharacter.
_ (Underscore) A comma, the beginning of the line, the end of the line, or a space.


Routing TCP[s]IP (Vol. 22001)
Routing TCP[s]IP (Vol. 22001)
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 182

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net