Configuring BGP BGP Overview
OmniSwitch 6800/6850/9000 Advanced Routing Configuration Guide December 2007 page 4-13
Regular Expressions
Regular expressions are used to identify AS paths for purposes of making routing decisions. In this
context, an AS path is a list of one or more unsigned 16-bit AS numbers, in the range 1 through 65535.
An ordinary pattern match string looks like:
100 200
which matches any AS path containing the Autonomous System number 100 followed immediately by
200, anywhere within the AS path list. It would not match an AS path which was missing either number,
or where the numbers did not occur in the correct order, or where the numbers were not adjacent to one
another.
Special pattern matching characters (sometimes called metacharacters) add the ability to specify that part
of the pattern must match the beginning or end of the AS path list, or that some arbitrary number of AS
numbers should match, etc. The following table defines the metacharacters used in the BGP implementa-
tion.
The regular expressions configured in the router are compared against an incoming AS path list one at a
time until a match is found, or until all patterns have been unsuccessfully matched. Unlike some imple-
mentations, which use a character-based pattern matching logic, the BGP implementation treats AS
numbers as single tokens, providing two benefits:
Symbol Description
^ Matches the beginning of the AS path list.
123 Matches the AS number 123.
. Matches any single AS number.
? Matches zero or one occurrence of the previous token, which must be an AS number,
a dot, an alternation, or a range.
+ Matches one or more occurrences of the previous token, which must be an AS num-
ber, a dot, an alternation, or a range.
* Matches zero or more occurrences of the previous token, which must be an AS num-
ber, a dot, an alternation, or a range.
( Begins an alternation sequence of AS numbers. It matches any AS number listed in
the alternation sequence.
| Separates AS numbers in an alternation sequence.
) Ends an alternation sequence of AS numbers.
[ Begin a range pair consisting of two AS numbers separated by a dash. It matches any
AS number within that inclusive range.
- Separates the endpoints of a range.
] Ends a range pair.
$ Matches the end of the AS path list.
, _ Commas, underscores (_), and spaces are ignored.