How to - two keywords to drop a string

Hello
i got a string and insyde i will have some keyword, if they come the packet have to be dropped. And important both keyword have to be in this string to drop

"UNKNOWN" and "Not confirmed"

i would like to use the Switch Node so a rule would be if fit both drop (empty output) else the packet will go to the next node to prozess.

[{"id":"6e1dd3f1.f0e5cc","type":"switch","z":"788a1dca.e79704","name":"\"CRC ERROR\"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"UNKNOWN\" and \"Not confirmed\"","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":180,"y":3120,"wires":[["971290e7.87919"],["94716062.98783","b5c6905.95db87"]]}]

what i have no is not working like this. ;-(
have a nice day
vinc

try a JSONata expression
e.g.

[{"id":"6e1dd3f1.f0e5cc","type":"switch","z":"c74669a0.6a34f8","name":"\"CRC ERROR\"","property":"payload","propertyType":"msg","rules":[{"t":"jsonata_exp","v":"$contains(payload,\"UNKNOWN\") and $contains(payload,\"Not confirmed\")","vt":"jsonata"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":250,"y":4020,"wires":[[],["27aae039.40c52"]]}]

Or use Regex or two switch nodes in series

@E1cid
thanks a lot, to read it seems so simple!
And had to wait for getting packets with error .
and it works great, thanks a lot
have a nice day
vinc

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.