jquery livesearch(filter) keeping the selected items
===

    <script type="text/javascript">
    $(function() {
      var opts = $('#optlist option').map(function(){
        return [[this.value, $(this).text()]];
      });
    
      $('#someinput').keyup(function(){
        var rxp = new RegExp($('#someinput').val(), 'i');
        var optlist = $('#optlist').empty();
        opts.each(function(){
          if (rxp.test(this[1])) {
            optlist.append($('<option/>').attr('value', this[0]).text(this[1]));
          }
        });
      });
    });
    </script>
    
    <input id="someinput"><br><select id="optlist" multiple="multiple">
    <option value="1">foo</option>
    <option value="2">bar</option>
    <option value="3">foobar</option>
    <option value="4">foobarbaz</option>
    </select>


This code works perfectly for a livevesearch(filter) on a html select(list).
But what if I have a multiple select list and I want to be able to select some
items, then search for a keyword but not to lose previously selected items.
Any ideas?
Thanks in advance. 