title: find a specific string pattern in an array jquery
body: <p>Apologies if this is a duplicate, but I can't seem to find the solution.
  I am trying to find a specific string pattern in an array.
  I want to find all values in data that contain 'underscore r underscore'. I then want to create a new array that contains only those keys and values.</p>
  
  <pre><code>var data = ["something", "bar_r_something"];
  var resultArray = new Array();    
  for (var i = 0; i &lt; data.length; i++) {
      var bar = /_r_/;
      if ($.inArray(bar, data[i].length) &gt; 0)
      {
         console.log("found _r_");
         resultArray.push(data[i]);
      }
  };
  </code></pre>
  
  <p>I just can't seem to get that $.inArray to work, it seems to always kick out -1.</p>