From: Francis Dupont Date: Sat, 8 Jun 2024 17:05:03 +0000 (+0200) Subject: [#3170] Updated doc and ChangeLog X-Git-Tag: Kea-2.7.0~50 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=0c210f551a999b4e0c1c740237514b40f323686b;p=thirdparty%2Fkea.git [#3170] Updated doc and ChangeLog --- diff --git a/ChangeLog b/ChangeLog index 3e8b106873..85efeb9519 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2253. [func] fdupont + Added the predicate token "match" which evaluates regular + expression matching. + (Gitlab #3170) + 2252. [bug] fdupont Corrected an issue in kea-dhcp6 which caused reserved prefixes to not be removed when their host reservation was deleted by diff --git a/doc/sphinx/arm/classify.rst b/doc/sphinx/arm/classify.rst index 94be28f5a2..c620d22633 100644 --- a/doc/sphinx/arm/classify.rst +++ b/doc/sphinx/arm/classify.rst @@ -474,6 +474,10 @@ Notes: | | | values and return | | | | ``true`` or ``false`` | +-----------------------+-------------------------+-----------------------+ + | Match | match('foo.*', 'foobar')| Match a regular | + | | | expression with a | + | | | value. | + +-----------------------+-------------------------+-----------------------+ | Not | not ('foo' == 'bar') | Logical negation | +-----------------------+-------------------------+-----------------------+ | And | ('foo' == 'bar') and | Logical and | @@ -563,6 +567,27 @@ addresses. The ``Int8ToText`` and ``UInt8ToText`` tokens expect 1 byte, the ``In ``UInt16ToText`` tokens expect 2 bytes, and ``Int32ToText`` and ``UInt32ToText`` expect 4 bytes. For all conversion tokens, if the data length is 0, the result string is empty. +Predicates +---------- + +The two predicates are Equal and Match. They can be used to build other +common predicates, for instance: +:: + not (substring('foobar', 3, 3) == 'bar') + match('foo.*', lcase('FooBar')) + match('.*foo.*', 'is it foo or bar') + match('^.*foo.*$', 'is it foo or bar') + +So inequality, case insensitive pattern matching or pattern search. + +.. note:: + + Detected invalid regular expressions are considered as syntax errors, + runtime exceptions during match are handled as no match. + Be careful with the match operator as it can show extremely bad + performance leading to regular expression denial of service (ReDoS). + + Logical Operators -----------------