Share feedback, ideas and get community help

Updated 11 months ago

How can i check a variable without case sensitivity?

Right now I use a condition element:
variable Contains string
OR
variable Contains String

How can I make this more elegant?
I tried to use regex /^string$/i but this does not seem to work.
2
E
L
B
30 comments
How can i check a variable without case sensitivity?
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.
The regex should work!
Can you provide a reproduction?
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.
Attachment
Screenshot_2024-02-25_at_14.40.01.png
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.
Attachment
image.png
Indeed, I reproduced.
Fixing it asap
Exactly. It converts to lowercase first.
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?
Attachment
image.png
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?
Like this?
Attachment
image.png
Doesn't work for me still.
It works when typing callback or Callback
Feel free to share your example to help me understand what's going on πŸ™‚
Add a reply
Sign up and join the conversation on Discord