title: jQuery Search for Text in a Variable?
body: <p>I have a variable that contains some text, some html, basically can be a string. I need to search the variable for a specific string to process that variable differently if it is contained. Here is a snippet of what I am trying to do, does not work obviously :)</p>
  
  <pre><code>$.each(data.results,
     function(i, results) {
     var text = this.text                   
     var pattern = new RegExp("^[SEARCHTERM]$");
      if(pattern.test( text ) )
      alert(text);  //was hoping this would alert the SEARCHTERM if found...
  </code></pre>