7210 SAS uses regular expression strings to specify match criteria for:
an AS path string; for example, ‟100 200 300”
a community string; for example, ‟100:200” where 100 is the ASN, and 200 is the community-value
A regular expression is expressed in terms of terms and operators. A term for an AS path regular expression is:
regular expressions should always be enclosed in quotes
an elementary term; for example, an ASN ‟200”
a range term composed of two elementary terms separated by the ‛-’ character like ‟200-300”
the '.' dot wild-card character which matches any elementary term
a regular expression enclosed in parenthesis ‟( )”
a regular expression enclosed in square brackets used to specify a set of choices of elementary or range terms; for example, [100-300 400] matches any ASN between 100 and 300 or the ASN 400
A term for a community string regular expression is a string that is evaluated character by character and is composed of:
an elementary term which for a community string is any single digit like ‟4”
a range term composed of two elementary terms separated by the ‛-’ character like ‟2-3”
a colon ':' to delimit the ASN from the community value
the '.' dot wild-card character which matches any elementary term or ':'
a regular expression enclosed in parenthesis ‟( )”
a regular expression enclosed in square brackets used to specify a set of choices of elementary or range terms; for example, [1-37] matches any single digit between 1 and 3 or the digit 7
The regular expression OPERATORS are listed in the following table.
Operator |
Description |
---|---|
|
Matches the term on alternate sides of the pipe. |
|
Matches multiple occurrences of the term. |
|
Matches 0 or 1 occurrence of the term. |
|
Matches 1 or more occurrence of the term. |
|
Used to parenthesize so a regular expression is considered as one term. |
|
Used to demarcate a set of elementary or range terms. |
|
Used between the start and end of a range. |
|
Matches least |
|
Matches exactly |
|
Matches |
|
Matches the beginning of the string - only allowed for communities. |
|
Matches the end of the string - only allowed for communities. |
|
An escape character to indicate that the following character is a match criteria and not a grouping delimiter. |
Examples of AS path and community string regular expressions are listed in the following table.
AS path to match criteria |
Regular expression |
Example matches |
---|---|---|
Null AS path |
|
Null AS path |
AS path is 11 |
|
11 |
AS path is 11 22 33 |
|
11 22 33 |
Zero or more occurrences of ASN 11 |
|
Null AS path 11 11 11 11 11 11 11 … 11 |
Path of any length that begins with ASNs 11, 22, 33 |
|
11 22 33 11 22 33 400 500 600 |
Path of any length that ends with ASNs 44, 55, 66 |
|
44 55 66 100 44 55 66 100 200 44 55 66 100 200 300 44 55 66 100 200 300 … 44 55 66 |
One occurrence of the ASNs 100 and 200, followed by one or more occurrences of the number 33 |
|
100 200 33 100 200 33 33 100 200 33 33 33 100 200 33 33 33 … 33 |
One or more occurrences of ASN 11, followed by one or more occurrences of ASN 22, followed by one or more occurrences of ASN 33 |
|
11 22 33 11 11 22 33 11 11 22 22 33 11 11 22 22 33 33 11 … 11 22 … 22 33 …33 |
Path whose second ASN must be 11 or 22 |
or
|
100 11 200 22 300 400 … |
Path of length one or two whose second ASN might be 11 or 22 |
|
100 200 11 300 22 |
Path whose first ASN is 100 and second ASN is either 11 or 22 |
|
100 11 100 22 200 300 |
Either AS path 11, 22, or 33 |
|
11 22 33 |
Range of ASNs to match a single ASN |
|
10 or 11 or 12 or 13 or 14 |
|
Null AS path 10 or 11 or 12 10 10 or 10 11 or 10 12 11 10 or 11 11 or 11 12 12 10 or 12 11 or 12 12 … |
|
Zero or one occurrence of ASN 11 |
|
Null AS path 11 |
One through four occurrences of ASN 11 |
|
11 11 11 11 11 11 11 11 11 11 |
One through four occurrences of ASN 11 followed by one occurrence of ASN 22 |
|
11 22 11 11 22 11 11 11 22 11 11 11 11 22 |
Path of any length, except nonexistent, whose second ASN can be anything, including nonexistent |
|
100 100 200 11 22 33 44 55 |
ASN is 100. Community value is 200. |
|
100:200 |
ASN is 11 or 22. Community value is any number. |
|
11:100 22:100 11:200 … |
ASN is 11. Community value is any number that starts with 1. |
|
11:1 11:100 11:1100 … |
ASN is any number. Community value is any number that ends with 1, 2, or 3. |
|
11:1 100:2002 333:55553 … |
ASN is 11 or 22. Community value is any number that starts with 3 and ends with 4, 5 or 9. |
|
11:34 22:3335 11:3777779 … |
ASN is 11 or 22. Community value ends in 33 or 44. |
|
11:33 22:99944 22:555533 … |