14

could anyone tell me what ip as-path access-list 100 deny .+_.+_.+_.+_.+_.+_.+_.+_.+_.+_.+_.+ stands for?!

I searched over the internet for the meaning of this regular expression, but I was unable to find any info.

2 Answers 2

18

Every time you see .+_, that regular expression represents a single BGP autonomous system. This as-path list denies BGP as paths equal to or longer than 12 paths long.

The regular expression works because . represents any character, + is a wild card which optionally repeats the previous character an unlimited number of times, and _ represents the space between the autonomous system paths. For more information, refer to the Cisco IOS Regular Expression guide, or this INE BGP Regular Expressions blog.

3
  • Hello Mike, thank you for your help and clarification. Very useful. Best regards.
    – ipermo
    Commented Sep 16, 2013 at 12:31
  • you are most welcome good luck with your project Commented Sep 16, 2013 at 12:37
  • 1
    As additional info, IOS has long supported 'bgp maxas-limit n' to make it easier to restrict AS-path size, however it is obviously global, while as-path ACL you can call more surgically.
    – ytti
    Commented Sep 16, 2013 at 13:26
-1

It'll be matching 12 AS-path list. But, I think a more appropriate way of matching it would be ^[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+_[0-9]+$, because the expression you mentioned might just match any character ie. special characters and alphabets included.

2
  • 1
    AS-path regular expression are not 'normal' regular expressions, it's already a given that only numbers can be used.
    – Teun Vink
    Commented May 9, 2015 at 8:47
  • 1
    I'm not completely sure this would work the way the OP needs it to. [0-9]+[0-9]+ doesn't account for the space between autonomous system paths. In plain terms, it says to match 0-9 ([0-9]) an infinite amount of times (+) followed directly by another set of infinite 0-9 sets ([0-9]+).
    – Ryan Foley
    Commented May 9, 2015 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.