Describe the problem/error/question
I’d like to be able to use an expression in a Set node to return an object of regular expression named capture groups, as an output object that can then be accessed by key/value in downstream nodes. The expression itself seems to return the correct object in the expression preview, but when executing the node fails in a somewhat unclear manner.
I’ve attached a sample workflow that parses the following string:
Color: Red, Size: Large
… in to two capture groups, with the following regular expression (expression):
{{ /Color: (?<color>.*), Size: (?<size>.*)/.exec($json.input_data).groups }}
… which should result in an object like the following (and this is what the expression preview shows):
[Object: {"color": "Red", "size": "Large"}]
What is the error message (if any)?
ERROR: Cannot read properties of undefined (reading 'name')
Please share your workflow
Share the output returned by the last node
Error details/cause:
ERROR: Cannot read properties of undefined (reading 'name')
[{"name":"match_groups","value":"={{ /Color: (?<color>.*), Size: (?<size>.*)/.exec($json.input_data).groups }}"}]
Error stack trace:
Stack
TypeError: Cannot read properties of undefined (reading 'name')
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1212:96
at Array.forEach (<anonymous>)
at cleanupParameterData (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1209:32)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1205:38
at Array.forEach (<anonymous>)
at cleanupParameterData (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1205:19)
at getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1293:9)
at Object.getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1519:24)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Set/Set.node.js:173:18)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:649:42)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:631:68
Information on your n8n setup
- n8n version: 1.1.1
- Database: SQLite
- n8n EXECUTIONS_PROCESS setting: main? Not specified/default
- Running n8n via: docker (compose)
- Operating system: Ubuntu 22.04.3
Thanks!