BGP regular expressions
- sh ip bgp regexp {pattern}: Will displays the result of the RegEx
* [0-9]*: All routes from this AS - ^[0-9]*$: This AS only
- _.*: Matches everything [permit any/all] [a space and anything]
- _100_: Match any route going through AS100
- _100 200_: Match any route passed through 100 and 200
- _100$: Match any route originated in AS100
- ^100$: Match only routes originated in AS100 that did not pass through any other AS
- ^100_: Match only routes transiting directly connected AS100, anything else behind
- ^100 .*: Match only routes received from AS100 or 1000..., anything else behind
- ^$ Match only routes originated from this AS
- .*: Match anything [usually at end as: permit .*]
- ( .*): matches a space plus a AS
- ( .*)*: matches a space plus a AS or a null string
- ?: To type ?: either Ctrl-V or Esc-Q
- .: Matches any single character, including white space.
- *: Matches 0 or more sequences of the pattern.
- +: Matches 1 or more sequences of the pattern.
- ?: Matches 0 or 1 occurrences of the pattern.
- ^: Matches the beginning of the input string.
- $: Matches the end of the input string.
- _: Matches a comma (,), left brace ({), right brace (}), left parenthesis, right parenthesis, the beginning of the input string, the end of the input string, or a space.
- []: Designates a range of single-character patterns.
- -: Separates the end points of a range.
- (): (Border Gateway Protocol (BGP) specific) Designates a group of characters as the name of a confederation.
- ^_250.*[0-9]$: 1 AS next away
- ^250_[0-9]*$: 1 AS next away, 250 = connected + next away [or none next away]
- ^250_(.+_)*888$: Originated by 888, connected to 250 and anything in between
- ^250(_.+)_*888$: Originated by 888, connected to 250 and anything in between
route-map test permit 10 match as-path 1 ! ip as-path access-list 1 permit ^651..$
This will only match if THE routes come from an AS that is between 651 to 65199
