28.06.2014 Views

Discussion

Discussion

Discussion

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Table 13-1. AS path regular expression operators<br />

Operator Description Match example<br />

{m,n} Match at least m and at most n repetitions of term. 65500{2,3}—Match only "65500 65500"<br />

and "65500 65500 65500".<br />

? Match zero or one repetition of term; equivalent to {0,1}. 65500?—Match only "65500" and "65500<br />

65500".<br />

{m } Match exactly m repetitions of term. 65500{2}—Match only "65500 65500".<br />

{m,} Match m or more repetitions of term. 65500{2,}—Match "65500 65500",<br />

"65500 65500 65500", "65500 65500<br />

65500 65500", and so on.<br />

* Match zero or more repetitions of term; equivalent to {0,}. 65500*—Match "65500", "65500 65500", and<br />

so on; also match a path that does not contain<br />

"65500".<br />

+ Match one or more repetitions of term; equivalent to {1,}. 65500 + —Match "65500", "65500<br />

65500", and so on.<br />

. (dot) Match any single instance of any term. 65500.—Match 65500 if it appears anywhere<br />

in the AS path. A more exact way to create this<br />

match is ".* 65500 .*".<br />

| Match one of the terms on either side of the pipe; the<br />

terms can include other operators.<br />

( ) Match a group of terms enclosed in the parentheses.<br />

You must include the term when defining the pattern to match, but the operator is<br />

optional. When you leave out an operator, the AS path exactly matches what you<br />

type for the term.<br />

The JUNOS regular expressions for AS paths are, for the most part, identical to Unix<br />

regular expressions. There are, however, a few differences. The main difference is<br />

that the basic unit of matching is an entire AS number, not an individual character.<br />

This means that the JUNOS regular expression treats 65500 as a single entity when it<br />

performs any matching operations, not as the five individual digits 6, 5, 5, 0, and 0. In<br />

other words, the AS number is effectively a single integer. A second difference is that<br />

with Unix, you need to type the operators ^ (which matches the beginning of a<br />

string) and $ (which matches the end of a string), but in the JUNOS regular expressions,<br />

these operators are always assumed to be present. So, with Unix you would<br />

type ^65500$ to match the string 65500, but in the AS path regular expression you just<br />

need to type 65500.<br />

Looking back at our recipe, the AS path match term and operator are:<br />

65500{4}<br />

(65500 | 65505)—Match either "65500" or<br />

"65505".<br />

– Match a range; the terms can include other operators. 65500-65505—Match 65500, 65501,<br />

65502, 65503, 65504, or 65505.<br />

"( )" Match a null AS path.<br />

^<br />

Indicates the character at the beginning of an AS path.<br />

$ Indicates the character at the end of an AS path.<br />

446 | Chapter 13: BGP<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!