title: How to convert jquery attr value to a string object to use it as a regex expression?
body: <p>i want to search a string variable if it contains a jQuery object's attr value. I have tryed this:</p>
  
  <pre><code>var txt = "lets go to a.html";
  var searchText = new RegExp($("#link").attr("href"));
  alert(txt.search(searchText)&gt;=0);
  </code></pre>
  
  <p>but this always returns false.
  im sure that $("#link").attr("href") returns "a.html" as value.
  also i have tried this if i was doing something wrong,</p>
  
  <pre><code>var txt = "lets go to a.html";
  var searchText = new RegExp("a.html");
  alert(txt.search(searchText)&gt;=0);
  </code></pre>
  
  <p>this time it has returned true.
  i thought jquery was not returning a string object and i have tried to turn it to string like this:</p>
  
  <pre><code>var txt = "lets go to a.html";
  var searchText = new String($("#link").attr("href"));
  searchText = new RegExp(searchText);
  alert(txt.search(searchText)&gt;=0);
  </code></pre>
  
  <p>this has aslo returned false..</p>
  
  <p>when i used toString($("#link").attr("href")) it always returns true even attr value is not "a.html"</p>
  
  <p>anyone can help me on this?
  thank you. </p>