Hi Nitay,
Sometimes, there are multiple ways to achieve the same thing with regex. The _ matches the space in between the AS numbers.
If this is what you want, I would use this regex:
show ip bgp regex ^([0-9]+)51$
The $ matches the end of the string. Here’s a quick test on a looking glass server for AS 4826:
route-views.optus.net.au>show ip bgp regex ^([0-9]+)_4826$
BGP table version is 1021954775, local router ID is 203.202.125.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 43.241.188.0/22 202.139.124.130 10 0 7474 4826 i
* 203.13.132.7 1 0 7474 4826 i
* 203.202.143.34 0 7474 4826 i
*> 203.202.143.33 0 7474 4826 i
* 192.65.89.161 1 0 7474 4826 i
It only shows results for AS 4826 behind any of our directly connected ASes. It won’t match on any ASes behind AS 4826.
Is this what you were looking for?
Rene