string shell pattern match

Hansen, Christoffer christoffer at netravnen.de
Fri Jun 14 13:49:34 CEST 2019


On 14/06/2019 12:58, Robert Sander wrote:
> according to the documentation for BIRD 1.6 it should be possible to use
> "shell patterns" with the ~ operator on strings:

If you look here: [0] & note the description in the docs you referred to
before. It should be clear enough the operators is meant to be used only
with filter language in functions.
"""
The filter language supports common integer operators (+,-,*,/),
parentheses (a*(b+c)), comparison (a=b, a!=b, a<b, a>=b). Logical
operations include unary not (!), and (&&) and or (||). Special
operators include (~, !~) for "is (not) element of a set" operation - it
can be used on element and set of elements of the same type (returning
true if element is contained in the given set), or on two strings
(returning true if first string matches a shell-like pattern stored in
second string)
"""

So if you create an function to check if the interface name matches a
certain pattern. And in your if() statement matched against true/false
return value of function. You should be able to do what you want.

Alternatively look at the examples present on the page at [0].

Christoffer

[0]: https://gitlab.labs.nic.cz/labs/bird/wikis/BGP_filtering


More information about the Bird-users mailing list