How to use the match regex?

Hi there,
I am following this:

  • {{#match str regExpStr}} : Returns true if str matches the regular expression regExpStr .
    but cannot figure out the correct syntax in the conditional block:

In this example I just want to see whether it contains the string not connected.
Thanks.

You’re trying to use a block helper string template in an input that takes an expression, which is why you’re running into problems.

The way I would solve this is as follows:

  • Before your Conditional Node, insert a Mutate Node.
  • In the Mutate Node, add a new value to your payload and set the value to {{#match data.current.ttn.body 'not connected'}}true{{else}}false{{/match}}. Also, check the “Treat value as JSON” checkbox. Put the value anywhere you want on your payload; for this example, let’s say it goes at working.isMatch.
  • Then, in your Conditional Node, the expression you check is simply {{working.isMatch}}. If it’s true, it will take the true path, and if false, it will take the false path.
1 Like

This makes sense yes.