Search text

I want to check if these are in a text file, if I do it without variables it works, as soon as I do it dynamically it doesn’t work anymore.

is not works:

{{ /$json["id"]/i.test($node["Webhook"].json["body"]["IDs"])}}

is works:

{{ /k5porfpb20h3o4o2j140sd41qs/i.test($node["Webhook"].json["body"]["IDs"]) }}

what is my mistake?

This is more about how Javascript works. You should be able to do this using new RegExp() instead:

{{ new RegExp($json["id"]).test($node["Webhook"].json["body"]["IDs"]) }}

Here’s an example:


thanks sirdavidoff, unfortunately it doesn’t work either, there should be 12 hits. Does anyone have a suggestion?


another try with ‘code’:

for (const item of $input.all()) {
  item.json.myNewField =  RegExp(["ID"]).test(["IDs"])

return $input.all();

what else could it be, does anyone have an idea?

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