I have an array that has around 1000 elements, for example:
var peoples = [
{ "name": "bob", "dinner": "pizza" },
{ "name": "john", "dinner": "sushi" },
{ "name": "larry", "dinner": "hummus" },
{ "name": "jacob", "dinner": "pizza" }
............];
I want to search the "dinner"s element of the array with a regex, so it doesn't has to be the exact type. For example, let's say the input is "piz"; it should then return all the matching elements as an array. In the example above, it should return:
var result = [{ "name": "bob", "dinner": "pizza" },
{ "name": "jacob", "dinner": "pizza" }]
I know how to search a string using the .match function in javascript, but I don't know how to use a similar function in an array. How can I do this?