Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

AS path regex

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
Bronze

Re: AS path regex

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 ----------- Pls kindly rate if helpful or answered your question.
New Member

Re: AS path regex

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 ?

Bronze

Re: AS path regex

Hmm, it's very simple.

Just press CTRL+V before typing "?".

Regards...

-Ashok.

With best regards... Ashok ----------- Pls kindly rate if helpful or answered your question.
750
Views
4
Helpful
3
Replies
CreatePlease to create content