title: How to search using regex in array in javascript
body: <p>I am trying to implement search filter and I have array:</p>
  <pre><code>Var aa = [&quot;Sage&quot;,&quot;Salsify (usually Purple Salsify or Oyster Plant)&quot;];
  
  var regex = RegExp(&quot;[a-zA-Z]?&quot;);
  var wordList = vegetables.filter((elem, index)=&gt;{
      return regex.test(elem);
  })
  </code></pre>
  <p>I think this will match only characters but how to get full string <code>&quot;Salsify (usually Purple Salsify or Oyster Plant)&quot;</code> when user type <code>Salsify</code>?</p>