#How can i check a variable without case sensitivity?
1 messages · Page 1 of 1 (latest)
Maybe converting to uppercase or lowercase before to compare
I'll try that. It would require to work with the script module. Which is kind of hard for someone like me. But I'll give it a shot. Thanks.
I tried to do it like this. But it did not work. I managed to write a javascript though with a different approach that works fine.
var checkExit = {{user-message-openai}}.toLowerCase();
if(['exit', 'quit', 'menu', 'home', 'back', 'ragequit'].includes(checkExit)) {
setVariable('user-message-openai', 'exit')
}
This script checks regardless of capital or lowercase letters if someone entered Exit, exit EXIT...
Maches regex doesn't work for me.
Hi Erisch. Sorry for being slow here, but does your script convert the user-message to lower case and then if it's exit, quit, menu, home, back, or rage quit it changes it to exit?
If you have a use case that does not work, provide a reproduction so that I can check if there is a bug on Typebot's side 🙂
regex documentation doesn't mention case sensitivity. But also it doesn't seem to work. In this case typing callback does nothing, human works.
Exactly. It converts to lowercase first.
ok
Should be fixed in 10 min
I saw it's resolved but I can't get it to work still. Should it be like this?
That works on my end
This regex matches only if user_answer is specifically: "callback"
So "Callback" won't work? How do I make it case insensitive?
/^callback$/i
Here is a simple working typebot: https://app.typebot.io/typebots/cluqn0gux000q113pb6zqoam2/edit
It works when typing callback or Callback