Open mlongob opened 8 months ago
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:
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:
https://blog.codinghorror.com/regex-performance/
So, here are some questions to think:
ExpressionEvaluator
?*
star or .
dot support for pattern matching? Is it difficult to implement a fast matching with only these 2?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