title: Convert a string variable to regular expression in java script?
body: <p>so I am trying to search a string for a sub string, and apparently, I must use regular expressions with the .search function, this is the code I have</p>
  
  <pre><code>var str = items[i].toLowerCase;
  var str2 = document.getElementById("input").value.toLowerCase;
  
  var index = str.search(str2);
  </code></pre>
  
  <p>Obhiously this doesn't work and I get an error, saying str.search is not a function, how would I go about changing these two strings into regular expressions?</p>
  
  <p>thanks</p>