JS is there a way to fix r"egex.test() only works half the time" [SOLVED]
In this code i'm making, I noticed that the regex.test() only works half the time. I read multiple threads about it on Stack Overflow (no answer though), and they said that it's because of the /text/g, which I don't have. I have a /text/gi though. Anyways, If you don't know what i'm talking about, you can experiment with the code: in the textarea, put "how many" and press "send". After a few seconds, it should say "Working". repeat the process. The second time, it'll say "not working" even though you put the same text in the textarea. https://code.sololearn.com/Wi4hy9HIJ3nc/#js If there's no fix for it, let me know if you know a different way to do what I'm tryin to do. What I'm tryin to do: var userQuestionA = "how many" or "how much" or "amount"; var userQuestionB = "who r u" or "who are you" or "who are u"; if (input.value matches any of userQuestionA) {ans = "blabla") // shouldn't be case sensitive if (input.value matches any of userQuestionB) {ans = "blabla"); // shouldn't be case sensitive