title: Return matches from array if contains specific words
body: <p>I have an array that contains several countries followed by an option and a number.</p>
  
  <p>0 " UK One 150 "</p>
  
  <p>1 " Switzerland Two 70 "</p>
  
  <p>2 " China Two 120 "</p>
  
  <p>3 " Switzerland One 45 "</p>
  
  <p>4 " China One 90 "</p>
  
  <p>5 " UK Two 50 "</p>
  
  <p>This is how I get the array using xpath:</p>
  
  <pre><code>    var iterator = document.evaluate('//xpath/li[*]', document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
  
  try {
    var thisNode = iterator.iterateNext();
    var arrayList = [];
  
    while (thisNode) {
      arrayList.push(thisNode.textContent); 
      thisNode = iterator.iterateNext();
    }
  
    for (var i = 0; i &lt; arrayList.length; i++) {
      console.log(arrayList[i]);
    }   
  } catch (e) {
    dump('Error' + e);
  }
  arrayList
  </code></pre>
  
  <p>What I would like to do with this array is to sort out and return only the matches. E.g. I would like for it to return only UK and China, so the array would look like this.</p>
  
  <p>0 " UK One 150 "</p>
  
  <p>1 " China Two 120 "</p>
  
  <p>2 " China One 90 "</p>
  
  <p>3 " UK Two 50 "</p>