Regular expressions, Regular expression characters, Regular expression examples – Enterasys Networks Security Router X-PeditionTM User Manual
Page 161

Overview
XSR User’s Guide 6-13
•
Set community attributes for a specific route with
set community
•
Set the origin for a specific route with
set origin
•
Set the MED of a specific route with
set metric
•
Set the local preference for a specific route with
set local-preference
•
Set the AS-Path list for a specific route with
set as-path
•
Set the dampening parameters for a specific route with
set dampening
•
Set the next hop IP address for a specific route with
set ip next-hop
Regular Expressions
Regular expressions commonly notate text string patterns. They specify rules for a set of strings
you may want to match in a search. With BGP, regular expressions search AS paths to match a
particular pattern and are especially useful in building complex policies. Regular expressions are
evaluated from left to right in sequence with binary logic. A number denotes a literal numeral and
AS number. Special characters denote position or operation within a string.
Regular Expression Characters
•
0 through 9 numerals are literals, used in any combination to represent an AS number
•
'^' marks the beginning of a path
•
'$' marks the end of a path
•
'{' marks the beginning of an AS_SET
•
'}' marks the end of an AS_SET
•
'(' marks the start of an AS_CONFED_SET or AS_CONFED_SEQ
•
')' marks the end of an AS_CONFED_SET or AS_CONFED_SEQ
To match AS numbers in an AS path, use any of the following expressions:
–
'.' Matches any valid AS number
–
'.*' matches 0 or more sequence or AS numbers
–
'.
+
' matches 1 or more of the sequence of AS numbers
–
'_' (underscore) matches 0 or 1 instance of any punctuation character
–
[ ] specifies a set of AS numbers or punctuation, for example, “[1234 45 6789]” or “[ {( ]”,
all members of a set must be the same type, i.e. either AS numbers or punctuation
–
'-' is used within brackets to specify a range of AS numbers, for example “[23 - 45]”
–
'^' when used as the first item within brackets specifies any AS number except the set
specified; for example, to specify any AS number other than 11 or 13 use “[^11 13]”
Regular Expression Examples
The following displays some common examples for matching AS paths using regular expressions
with the
show ip bgp regexp
command.
•
Display all routes with a single AS number in the AS path:
–
show ip bgp “.”