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
var str = "teXT To seArch";
var r = new RegExp(
str.split('').map(function(c){return '['+c.toLowerCase()+c.toUpperCase()+']'}).join('')
+ ' TOP SECRET'
);