Word-check expression


Please help.

I need to make an expression that will check the incoming text for at least one of the words, case insensitive.
Right now, for each word I add two validation expressions.
In the future, a list of these words will be taken for each call from mysql.

Can you tell me if n8n can do such checks with expressions?

Information about my n8n setup

  • n8n version: 0.217.2
  • Database: mysql
  • Running n8n with the execution process [main]:
  • Running n8n via [Docker]:

Hi @brewoutlay, welcome to the community :tada:

n8n supports regular expressions in the IF node. So you could use a regular expression such as /word1|word2|word3/i to perform your check. Here’s a quick example workflow:

The n8n expression I am using inside my regular expression is $("Mock word list").first().json.words.join("|"). This reads the first item from my “Mock word list” list node and then joins all words in my “words” field using a pip character |. It will of course also work with more than 3 words.

Hope this helps! Let me know if you have any further questions on this :slight_smile:

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