N8N how to use regex in filter node?

Describe the problem/error/question

I have a json payload that comes as input to a filter.
Filter has to look at the input and only pass json objects which don’t have values like (a|b|c|d)

I have put regex in filter node with operation ‘Regex Not Match’ on the input string
exact regex I put in : /(Unknown|unknown|value|not provided)/

I am assuming I m making syntax error while feeding in the regex, please let me know how to write a proper regex in n8n as I was not able to find any documentation online.

What is the error message (if any)?

Error that I am getting is that unwanted values are moving forward from the filter

Please share your workflow

{
“meta”: {
“instanceId”: “b21c5c764b1c163869f34ac65ce947166061ef1893d05087f4d6fedc65f1229b”
},
“nodes”: [
{
“parameters”: {
“conditions”: {
“string”: [
{
“value1”: “={{ JSON.parse($json["message"]["content"]).department }}”,
“operation”: “isNotEmpty”
},
{
“value1”: “={{ JSON.parse($json["message"]["content"]).department }}”,
“operation”: “notRegex”,
“value2”: “/(Unknown|unknown|value)/”
}
]
}
},
“id”: “4ce4c87f-8c44-4d6b-bfd8-83d0da112c93”,
“name”: “Filter SYL response empty1”,
“type”: “n8n-nodes-base.filter”,
“typeVersion”: 1,
“position”: [
900,
1280
]
}
],
“connections”: {},
“pinData”: {}
}

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@Pallav_Jagoori , you RegEx looks fine to me and it works with my test. The problem is likely to be with the reference to the value you test, {{ JSON.parse($json["message"]["content"]).department }} if that does not work for you.

Take a look at my example. It has three items with the values “value”, “volume”, and “unknown” respectively. The items containing “value” and “unknown” are filtered out leaving only “volume”