If you have a given set of words or codes (usually for text forms), what is the most efficient regex to use in the web-app validation such that the user can input the word or code in any case (upper, lower, or mixed)? I have tried /^(word1|word2)$/i but this doesn’t seem to work.