Check if ANY word in an array is contained in a string?

Support
  • I have an array with data like "Bob, Amy, James" etc..

    I need a working IF statement to check if ANY of the words in an array are contained in a string, and also included partial matches. Meaning if a string = "hellobob123" it would still be true because it contains "bob"

    I'm still new to JS so not sure how I would go about this..

    Alternatively, I can use a text file instead of an array, but each word would be on a different line. I don't mind using this option either, but it needs to check every word in the text file (or array) for a partial match in [[VARIABLE]]

    Please help, thanks

  • @spockthe40oz said in Check if ANY word in an array is contained in a string?:

    I have an array with data like "Bob, Amy, James" etc..

    I need a working IF statement to check if ANY of the words in an array are contained in a string, and also included partial matches. Meaning if a string = "hellobob123" it would still be true because it contains "bob"

    I'm still new to JS so not sure how I would go about this..

    Alternatively, I can use a text file instead of an array, but each word would be on a different line. I don't mind using this option either, but it needs to check every word in the text file (or array) for a partial match in [[VARIABLE]]

    Please help, thanks

    This can only be done by iterating through the elements, use the "foreach" action.

    9a03e839-795f-4b80-b172-19d8062817b2-изображение.png

    1792.xml