How to ignore case sensitivity with regex validation?

(Daniel Souza Bertoldi) #1

Hello FlowXO community,

Is there anyway to use the case insensitive tag when using regex validation? I’ve tried to put the /i tag at the end of my regex but it didn’t work :confused:. Is there anyway to achieve this?

Thank you for your time :slight_smile:

(Daniel Beckett) #2

Hmm, Regex validation isn’t exactly our speciality but I’ll certainly try to help.

Could you share an example of the full regex being used? Can you also give me a quick description of what you want the validation to do? :slight_smile:

(Daniel Souza Bertoldi) #3

Hello again Daniel,

Sorry for the confusion, I wasn’t very clear on my problem. What I’m trying to ask is: is there a way for me to use the /i flag to make my regex case insensitive?

My regex filters out certain words in an answer and I just want a way to force the regex to search for these words in a case insensitive manner just so I don’t have to type all the variations of each word.

Here’s the demonstration of my current regex:

^((?!word1|word2|word3|Word1|Word2|Word3|WORD1|WORD2|WORD3).)*$

The smart way of doing this would be to use the /i flag, making the regex case insensitive, like so:

^((?!word1|word2|word3).)$/i (doesn’t work)
Or
(?i)^((?!word1|word2|word3).)
$ (invalid)

I’ve already tried to test this but the chatbot didn’t validate any of the correct answers.

Please, tell me if the problem isn’t very clear yet, I’ll try my best to explain it again.

(Daniel Beckett) #4

Have you considered using the built in filters instead? For example:

Edit: Just to clarify, using ‘does not contain’ is case insensitive so will match on word, WORD, woRd etc.

1 Like
(Daniel Souza Bertoldi) #5

Hello Daniel, sorry for the late response.

Yeah, I’ve considered using the built in filters, it’s just that I have a wide range of words to filter and have them all in a single line is much more practical.

Thank you for the tips! :slight_smile:

(Daniel Beckett) #6

Another potential way of handling this is to use the Text service to ‘Apply Case’ to the text, i.e make it all lower or upper case. Your regex won’t need to worry about case sensitivity then.

2 Likes