Skip to content

Instantly share code, notes, and snippets.

@glenndevenish
Created February 14, 2018 14:29
Show Gist options
  • Save glenndevenish/763a9b1b80abe0b056f499721131df9e to your computer and use it in GitHub Desktop.
Save glenndevenish/763a9b1b80abe0b056f499721131df9e to your computer and use it in GitHub Desktop.
Use an input with id of 'search' to filter array 'arr' - matches space-separated words
arr.filter(arr => arr.name.match(new RegExp($("#search").val().replace(/ /g, "|"), "i")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment