PricingBlog

Restricting Certain Words in Inputs

  • fuelmeup-1261010706187419769

    AY EYE

    1 year 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?
  • lucasg-1261018805480718359

    Lucas G

    1 year 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
  • fuelmeup-1261019060246937690

    AY EYE

    1 year ago

    okay let me try
  • lucasg-1261019105868251249

    Lucas G

    1 year ago

    Wouldn't include words that aren't space
  • somethinglikethis for example
  • fuelmeup-1261019202668466217

    AY EYE

    1 year ago

    hmmm so then someone could bypass the filter by doing that right?
  • lucasg-1261019593162358855

    Lucas G

    1 year ago

    In my example, yes
  • lucasg-1261019905701183629

    Lucas G

    1 year 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
  • fuelmeup-1261042091019079742

    AY EYE

    1 year ago

    Ok
  • fuelmeup-1261086780011057232

    AY EYE

    1 year 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
  • lucasg-1261087189261877259

    Lucas G

    1 year ago

    probably because it is capitalized
  • fuelmeup-1261087295818436688

    AY EYE

    1 year ago

    ohhh
  • no, it still doesn't work
  • even hen capitalized
  • lucasg-1261087513070801056

    Lucas G

    1 year ago

    your split
  • is splitting into letters
  • not words
  • there is no delimiter set
  • lucasg-1261087844043325440

    Lucas G

    1 year ago

    Split with a 'space' ( " " ) delimiter
  • fuelmeup-1261088240904179733

    AY EYE

    1 year ago

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

    Lucas G

    1 year ago

    you'll probably want to lowercase everything to check it
  • there's a formula node for it
  • lucasg-1261091193689997422

    Lucas G

    1 year ago

    lowercasing would be the preferred thing to avoid random capitals in words, etc
  • fuelmeup-1261095122788028476

    AY EYE

    1 year ago

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