title: How to match an out of order string with Javascript regular expressions
body: <p>I've written a live filter in javascript that takes a value from a field and hides the rows in a table that do not match.</p>
  
  <p>The RegEx I use for this is very simple: /inputValue/i</p>
  
  <p>Although this works great it only matches characters that are in order. For example:</p>
  
  <pre><code>inputValue = test
  string to match = this is a test sentence
  </code></pre>
  
  <p>This example would match, but if I tried:</p>
  
  <pre><code>inputValue = this sentence
  string to match = this is a test sentence
  </code></pre>
  
  <p>This won't match because the input value is out of order.</p>
  
  <p>How would I go about writing a RegEx that is in order but can skip words?</p>
  
  <p>Here is the loop I currently use:</p>
  
  <pre><code>for (var i=0; i &lt; liveFilterDataArray.length; i++) {
  
    var comparisonString = liveFilterDataArray[i],
      comparisonString = comparisonString.replace(/['";:,.\/?\\-]/g, '');
  
    RE = eval("/" + liveFilterValue + "/i");
  
    if (comparisonString.match(RE)) {
      rowsToShow.push(currentRow);
    }
    if(currentRow &lt; liveFilterGridRows.length - 1) {
      currentRow++;
    } else {
      currentRow = 0;
    }
  }
  </code></pre>
  
  <p>Many thanks for your time.</p>
  
  <p>Chris</p>