fork(1) download
  1. set a {Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
  2. D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
  3. N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
  4. E1 - OSPF external type 1, E2 - OSPF external type 2
  5. i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
  6. ia - IS-IS inter area, * - candidate default, U - per-user static route
  7. o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
  8. + - replicated route, % - next hop override
  9.  
  10. Gateway of last resort is 10.17.1.252 to network 0.0.0.0
  11.  
  12. B* 0.0.0.0/0 [200/0] via 10.17.1.252, 01:16:22
  13. 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
  14. C 10.17.1.0/24 is directly connected, FastEthernet1/0
  15. L 10.17.1.253/32 is directly connected, FastEthernet1/0
  16. 172.22.0.0/32 is subnetted, 1 subnets
  17. C 172.22.12.250 is directly connected, Loopback1
  18. 172.26.0.0/16 is variably subnetted, 3 subnets, 2 masks
  19. B 172.26.69.64/30 [200/0] via 10.17.1.252, 01:16:33
  20. C 172.26.70.64/30 is directly connected, FastEthernet0/0
  21. L 172.26.70.66/32 is directly connected, FastEthernet0/0}
  22.  
  23. proc reEscape {str} {
  24. regsub -all {\W} $str {\\&}
  25. }
  26. set bgp_neighbor {10.17.1.252}
  27. set bgp_neighbor_escaped [reEscape $bgp_neighbor]
  28. set reg {\y0\.0\.0\.0/0 \[200/0] via }
  29. append reg $bgp_neighbor_escaped
  30. append reg {\y}
  31. puts $reg
  32. if {[regexp $reg $a]} {
  33. puts yes
  34. } else {
  35. puts no
  36. }
Success #stdin #stdout 0s 28240KB
stdin
Standard input is empty
stdout
\y0\.0\.0\.0/0 \[200/0] via 10\.17\.1\.252\y
yes