Regex Match using variable from previous node in IF node

Hi there, I’m running into an issue to use Regex Match in an IF node using a regex stored in a previous node. Can somebody spot my mistake or help me find a workaround ?

In this instance, I would expect the True Branch to only contain “versionTag”:
“0.199.0”, and the False Branch to contain all other results.

Hi @alxnzx, based on your screenshot it’s unfortunately hard to say what exactly is happening. Perhaps you can share an example workflow including some dummy data using which your problem can be reproduced?

My first guess is that your sourceSwitch node returns a different number of items than your versionFilter node receives. So you might need to use an expression like {{ $("sourceSwitch").first().json.yourRegexField }} to always use the first field from your sourceSwitch node for the comparison, similar to what I described over here.

Hi @MutedJam and thank you for your answer. I have tried but it doesn’t seem to work. My sourceSwitch only sends one item as shown in the screenshot here.


Could it be that I need to escape somehow the versionRegex that I pass to it?

(I’ll share the workflow in a moment)

Solved it. Had to use $('sourceSwitch').itemMatching(0).json.versionRegex. For some reason (the fact that it’s a switch node?) the $('sourceSwitch').first().json.versionRegex did not return any result.

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