AS path regex

Unanswered Question
May 29th, 2008

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 ?


  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4 (1 ratings)
ashok_boin Thu, 05/29/2008 - 23:23

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.



gayanhewa Sun, 06/01/2008 - 15:33

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 ?

ashok_boin Sun, 06/01/2008 - 21:59

Hmm, it's very simple.

Just press CTRL+V before typing "?".




This Discussion