Question: I have problem use array keyword and non-casesensitive search in innerHTML
I am trying write Greasemonkey JS which will remove tags which are containning keywords 

```
 function removebadcriptts() {

 var  scriptslinks = ['jumper.php','redirect.php'];
 var theLinks = document.getElementsByTagName("script");

 for (var i=0; i<scriptslinks.length; i++)
 {
   for (var j=0;j<theLinks.length;j++)
   {
     if (theLinks[i].innerHTML.search("/"+scriptslinks[i]+"/i/")  !== -1)
      /keyword/i = regular expression for non-case is not working
     {     
      console.error("InnerHTML Keyword found ");      
      theLinks[j].parentNode.removeChild(theLinks[j]);
     } 
     else
     {
       console.error("InnerHTML Keyword  not found ");   
     }
   }
 }
}

```

Can anybody help howto remove and match this kind of scripts and remove from WEBpage also howto catch scripts which are injecting scripts into loaded webpage

Answer: 
[`search`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/search) expects a [*RegExp* object](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp). So try this:

```
theLinks[i].innerHTML.search(new RegExp(scriptslinks[i], "i"))

```

Although you can pass a string too, it would be used create an *RegExp* object like `new RegExp(string)` but you can’t set the *i* modifier with that.

Furthermore, you should escape the special character of a regular expression like the `.`. You can use this method to do so:

```
RegExp.quote = function(str) {
    return str.replace(/(?=[\\^$*+?.()|{}[\]])/g, "\\");
}

```
Try using .Match, and i believe the regex would have to look like:

```
/scriptslink[i]/i

```