Heya, found this great snipped here in Node-RED Forum
There was explained on how to get a message checked for its string. But in this case it must be exactly the right string, what do I have to do if I have to check if the string is just inside the a bigger string?
In my concrete case I want to test if the msg.topic
contains 2029FD
or 7085AC
and the topic looks like this:
shelly.0.SHPLG-S#2029FD#1.Relay0.Switch
or
shelly.0.SHPLG-S#7085AC#1.Relay0.Switch
This switch node will have multiple other topics going in. So the "contains" option will not help because those 2 should go to the same output.
Sure I can do it with the looooooooooooooong string but it is my goal to make it as clean as possible
EDIT: added the description why contains isn't a solution for me