You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is currently a single useful operator for string properties (== and !=). For use-cases that need more powerful pattern matching, the following operations would be useful:
Checking that a string contains another string
Checking that a string starts with another string or a character
Doing pattern matching on a sub-section of an URI (example: /var/log/foobar/*/*.log.)
mlongob
changed the title
Subscriptions expressions: more powerful pattern matching on string-typed properties
Subscriptions expressions: More powerful pattern matching on string-typed properties
Mar 18, 2024
When we worked on subscriptions, we tried to limit expressions complexity and ensure that it's impossible to build an expression which takes too long to evaluate.
This is why we have constraints like this in the expression evaluator:
/// The maximum number of operators allowed in a single expression.
k_MAX_OPERATORS = 10,
k_MAX_PROPERTIES = 10
// The maximum number of properties allowed in a single expression.
};
RegEx engine looks like a ready tool to do exactly what we might need to do for a more powerful pattern matching. However, it's usage goes against our initial design and expected usage scenario, because it allows to reduce BlazingMQ performance drastically.
In this article, you can find an example of a short RegEx which takes seconds to evaluate on a short string, and it can be even worse:
Note that this is not a property of regular expressions, but rather a property of backtracking regular expression engines. Strings can be checked against regular expressions (without lookahead assertions) in linear time. PCRE is a backtracking regex matcher, but there are others that don't suffer from this; see for example https://github.com/google/re2/wiki/WhyRE2, designed for similar use cases to ours.
Is there an existing proposal for this?
Is your feature request related to a problem?
There is currently a single useful operator for string properties (
==
and!=
). For use-cases that need more powerful pattern matching, the following operations would be useful:/var/log/foobar/*/*.log.
)Describe the solution you'd like
A regex operator would solve many of those problems. We can use the following library to compile regexes without introducing additional dependencies to the broker:
https://github.com/bloomberg/bde/blob/d6674e1df52b62d66942ca318882f225d26104bf/groups/bdl/bdlpcre/bdlpcre_regex.h#L669
Alternatives you considered
No response
The text was updated successfully, but these errors were encountered: