Log in
Log into community
Share feedback, ideas and get community help
View all posts
Related posts
Did this answer your question?
π
π
π
Powered by
Hall
Inactive
Updated 11 months ago
0
Follow
How can i check a variable without case sensitivity?
How can i check a variable without case sensitivity?
Inactive
0
Follow
E
Erisch
11 months ago
Β·
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
Share
Open in Discord
E
Erisch
11 months ago
How can i check a variable without case sensitivity?
L
LuizAlves
11 months ago
Maybe converting to uppercase or lowercase before to compare
E
Erisch
11 months ago
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.
B
Baptiste
10 months ago
The regex should work!
B
Baptiste
10 months ago
Can you provide a reproduction?
E
Erisch
10 months ago
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
E
Erisch
10 months ago
var checkExit = {{user-message-openai}}.toLowerCase();
if(['exit', 'quit', 'menu', 'home', 'back', 'ragequit'].includes(checkExit)) {
setVariable('user-message-openai', 'exit')
}
E
Erisch
10 months ago
This script checks regardless of capital or lowercase letters if someone entered Exit, exit EXIT...
d
drippingfist
9 months ago
Maches regex doesn't work for me.
d
drippingfist
9 months ago
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?
B
Baptiste
9 months ago
See
https://docs.typebot.io/editor/blocks/logic/condition#operators
B
Baptiste
9 months ago
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 π
d
drippingfist
9 months ago
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
B
Baptiste
9 months ago
Indeed, I reproduced.
B
Baptiste
9 months ago
Fixing it asap
B
Baptiste
9 months ago
https://github.com/baptisteArno/typebot.io/issues/1393
E
Erisch
9 months ago
Exactly. It converts to lowercase first.
M
Mark's
9 months ago
ok
B
Baptiste
9 months ago
Should be fixed in 10 min
d
drippingfist
9 months ago
I saw it's resolved but I can't get it to work still. Should it be like this?
Attachment
B
Baptiste
9 months ago
That works on my end
B
Baptiste
9 months ago
This regex matches only if
user_answer
is specifically: "callback"
d
drippingfist
9 months ago
So "Callback" won't work? How do I make it case insensitive?
B
Baptiste
9 months ago
/^callback$/i
d
drippingfist
9 months ago
Hmmm
d
drippingfist
9 months ago
Like this?
Attachment
d
drippingfist
9 months ago
Doesn't work for me still.
B
Baptiste
9 months ago
Here is a simple working typebot:
https://app.typebot.io/typebots/cluqn0gux000q113pb6zqoam2/edit
B
Baptiste
9 months ago
It works when typing
callback
or
Callback
B
Baptiste
9 months ago
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
Join on Discord