Describe the problem/error/question On n8n, what has better performance, string primitives (string conversion), or regular expression with case insensitivity?
It appears string primitives are faster than regex in general, unless it’s compiled regex, which I’m not sure what n8n uses.
So in an IF node doing a REGEX MATCH, which would be faster
{{ $json.body.direction}}
{{ /^(up|down)$/i }}
{{ $json.body.direction.toLowerCase() }}
{{ /^(up|down)$/ }}
What is the error message (if any)? NONE
Please share your workflow
{
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “5d81b031d071ea343947e29f1e3553f1aac61d04d0e5e9bd7aedadd24853ad2e”
},
“nodes”: [
{
“parameters”: {
“conditions”: {
“string”: [
{
“value1”: “={{ $json.body.direction}}”,
“operation”: “regex”,
“value2”: “={{ /^(up|down)$/i }}”
}
]
}
},
“id”: “cee85c65-60c8-410d-9fd6-ab42217256bc”,
“name”: “Input Validation - direction”,
“type”: “n8n-nodes-base.if”,
“typeVersion”: 1,
“position”: [
-2368,
2107
]
}
],
“connections”: {},
“pinData”: {}
}
Share the output returned by the last node
Information on your n8n setup
- n8n version: 1.25.1
- Database (default: SQLite): n/a
- n8n EXECUTIONS_PROCESS setting (default: own, main): main
- Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
- Operating system: n/a