cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2209
Views
4
Helpful
3
Replies

AS path regex

gayanhewa
Level 1
Level 1

In BGP, to see AS path prepended routes I use below Regex.

sh ip bgp regexp _([0-9]+)(_\1)+_

Can anyone tell me how to write regular expressions to filter routes matching below conditions.

1. All BGP routes with no AS path prepends

2. All BGP routes with AS path prepended only 2 times

Are these possible with regular expressions ?

Thanks

3 Replies 3

ashok_boin
Level 5
Level 5

I don't know answer about the first question. But for 2nd, use the following reg exp _([0-9]+)(_\1)?_ which lists the routes either without prepend or with AS-path listed 2 times.

Regards...

-Ashok.


With best regards...
Ashok

Thanks Ashok for the reply.

For the first, I used other command to filter routes.

sh ip bgp | exclude _([0-9]+)(_\1)+_

But when I tried your reg exp, the '?' character is interpretted by CLI as a special character and CLI moves to a new line. How can I tackle this ?

Hmm, it's very simple.

Just press CTRL+V before typing "?".

Regards...

-Ashok.


With best regards...
Ashok
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card