Match multiple rules in Switch?

Describe the problem/error/question

I’m trying to figure out if there is a way to create a rule in a switch node that matches on 2 values before sending to the output. I’m trying to match an email on the to address and contents of the subject. Matching on 1 rule is trivial but my brain can’t seem to work out creating an expression that would match on more than one thing… lol… My other thought was to get another node involved but that seems like an elegant solution.

What is the error message (if any)?

Please share your workflow

Switch v3
Routing Rules
Expression (get’s the “to” value from the email)
{{ $json.to.replaceAll(/<|>/gi, “”) }}

String is equal to
[email protected]

Output Name
some-output

(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: 1.45.1
  • Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 24

@Crypto_T3CH , you can combine the two properties and compare the outcome with the values combined in the very same way. For example, {{ $json.email + $json.subject }} or {{ [$json.email, $json.subject].join(' ') }} (you can join the properties with a custom character) as depicted in the screenshot.

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