Obviously we could use JSONata or regex to simulate this functionality but I think his point is valid. If we are using topics and have MQTT wildcard features for MQTT, it would seem like the obvious thing to add MQTT-like wildcard filtering to the switch node?
With wildcard everyone also imagines something different. For example, I think of wildcard more about have a * as wildcard which stands for multiple characters and not the MQTT-like #.
I only think that this option should then be named a little more specifically.
On the other hand, I have been using the contains in the switch node for this type of filtering in the past.
That's true. But having multiple options to do almost the same thing might also be confusing when to stop using the "simple" one when to start using the "complex" one. I am no regex specialist, but regex101.com is my friend
Putting a link to a simple regex tool could be an alternative to me.
@greengolfer please remember that An unescaped delimiter must be escaped with a backslash () so a simple query would look like home\/.+\/temperature\/status compared to home/+/temperature/status
Topic filter could be confusing, but MQTT filter or MQTT topic would be clear (using the word 'MQTT' makes it's intended use clear, and leaves the regex option open for more advanced users).
Topic or MQTT filter is confusing as it implies it's for topic payloads or, has something to do with MQTT as it could just be used for path filtering, without MQTT. Maybe PATH Filter. Also escaping the / is also pron to errors and confusion.
[edit The ability to pass on the # or + match would be neat to]
Perhaps "matches pattern" , and such a pattern can contain wildcards. Similar to the "matches regex" option... Although a regex is also a pattern of course...
IMHO this feature can be used in most use cases instead of regexp. For me personally, lack of this function was the sole reason why I dropped the use of topics in my project altogether, and probably all people that come from "embedded c" world would also try to avoid regexp
The fact that it would be inline with MQTT is also worth noticing
I think thit this should have lot higher grade then 1/10, maybe 3/10
To me - either it is an MQTT wildcard type filter or it isn't. If it is then it may as well be called an MQTT filter and accept just + and # as the wildcards correctly (eg foo/+/bar is ok - but foo/ab+c/bar is not) .
If not then it is something else and why wouldn't contains or regex etc do, as otherwise it's yet another syntax to learn. (and of course if someone wants to add a regex helper/tester then that could also be an option instead)
Unless I've misread, that is exactly what has been suggested.
It would be a useful addition, because it would widen the scope of using MQTT topics & wildcards, which I would suggest are not currently used to their full potential by most 'non-technical' users (me included)
I must admit that I have never used mqtt filters. So when I should see an "mqtt filter" option, I assume I would never use it. I don't mean that I don't like the concept of the mqtt filter examples above, but I would not expect that it would offer me pattern matching via wildcards on any (non-mqtt) messages...
I think if you are going to do this, you need to get rid of the escapes. Otherwise you might as well use regex. Its only real purpose is ease of use and ease of learning. So it should work exactly like an MQTT topic filter as stated.
I think I'd put it at a 5 myself. There are certainly times when I'd be happy to use it and it would certainly sometimes replace single, more complex, function nodes.