Help forum

Restricting Certain Words in Inputs

  • AY EYE

    2 years ago

    Hey all! Im trying to build a filter that prevents people from using certain words. I have a switch node so that if a word is in the input it won't continue. I thought using the includes function would work for this but it doesn't seem to be doing the job as if i enter a word that i have in my array of banned words, it shows false when it should show true.

    I thought using the some function would work but the some looks for letters in words vs entire words.

    IE: I type mall, but it wont continue because all is in the word and thats also in the words that are banned.

    Whats the best way to do something like this?
  • Lucas G

    2 years ago

    Yo use both of those
  • 1261018812338278440-image.png
  • String split by a space delimiter " " for example then the words are checked against your list
  • AY EYE

    2 years ago

    okay let me try
  • Lucas G

    2 years ago

    Wouldn't include words that aren't space
  • somethinglikethis for example
  • AY EYE

    2 years ago

    hmmm so then someone could bypass the filter by doing that right?
  • Lucas G

    2 years ago

    In my example, yes
  • Lucas G

    2 years ago

    But you wouldn't be able to fully restrict it anyways as you pointed out that matching by letters would ban mall or wall, etc if 'all' is a banned word
  • AY EYE

    2 years ago

    Ok
  • AY EYE

    2 years ago

    @Lucas G I tried your way: but still doesn't work
    1261086779700809739-image.png
  • Blood is inlcluded in the banned words so it should show true but its showing false
  • Lucas G

    2 years ago

    probably because it is capitalized
  • AY EYE

    2 years ago

    ohhh
  • no, it still doesn't work
  • even hen capitalized
  • Lucas G

    2 years ago

    your split
  • is splitting into letters
  • not words
  • there is no delimiter set
  • Lucas G

    2 years ago

    Split with a 'space' ( " " ) delimiter
  • AY EYE

    2 years ago

    I see
  • Yes that worked
  • Thank you! @Lucas G
  • Lucas G

    2 years ago

    you'll probably want to lowercase everything to check it
  • there's a formula node for it
  • Lucas G

    2 years ago

    lowercasing would be the preferred thing to avoid random capitals in words, etc
  • AY EYE

    2 years ago

    yup i did exactly that
  • and works perfectly
  • thanks!