AS-Path Regexp matching

I’m trying to use this format (from the documentation) but my devices (7.19.6) won’t accept it:

[ ]

[^ ]

Represents the set of AS numbers where one AS number from the list must match.

Use ^ after opening the bracket to negate the set.

It is also possible to reference the pre-defined num-lists from num-list with [[:numset_name:]]

^[1234 5678 1-100]

will match the AS-path that starts with 1234 or 5678 or from the range of 1 to 100

Ideally I’m looking to match any one of a group of AS numbers at the start of the BGP path.

Thanks,

Luke

What’s the filter command you are trying to add, and what happens when you try it?

Something like this should work:

if (bgp-as-path [[:match_these:]]^) {action}

And a num-list:

/routing filter num-list add disabled=no list=match_these range=65534

Don’t use regexp matching of the AS path for that, it is inefficient and cannot match the start of the path.

Use bgp-input-remote-as to select the AS number of the peer. You can use a number set to match multiple numbers (but not as a regexp, you can use a range).

Unfortunately this isn’t what I need to do - we’re looking to set route attributes for certain remote AS numbers (the peer in this case is a route server not an individual AS)

As an example of the exact syntax I’m trying to use (taken from the documentation)

if (bgp-as-path ^[1234 5678 1-100]) { set suppress-hw-offload no }

"Word {bgp-as-path} Word {^[1234} Word {5678} Word {1-100]} " - invalid bgp-as-path regexp (6)

It seems to want the regexp in quotes. Your option works too and might be better for what I need - thanks

It is unclear to me why you write ^[1234 5678 1-100] when you want it to “match anywhere in the path”.

The ^[ means “at the beginning of the path”. It means “negation” only when inside the brackets like [^

It is unclear to me why you write ^[1234 5678 1-100] when you want it to “match anywhere in the path”.

I was always trying to match the first AS in the path only, hence why I used “^”