I want to know if Javascript RegExp has the ability to turn on and off case insensitivity within the regular expression itself. I know you can set the modifier for the entir
Don't think so. I'd suggest doing this:
var m; var str = "teXT To seArcH TOP SECRET"; if ((m = str.match(/text to search (top secret)/i)) && m[1].match(/TOP SECRET/)) { // matched. }