Looking to filter elements from an array
based on partial matching of a string
. For example, trying to match PGVF.NonSubmit.Action
with NonSubmit
by checking if the string
contains certain keywords. The current code is not functioning as expected and only matches complete string
.
Below is the existing code:
for (let i = 0; i < appNames.length; i++)
{
var strToMatch = appNames[i];
let obj = products.filter(x => strToMatch.includes(x.Name));
}
The goal is for obj
to receive multiple records that match partially. This needs to be done within the loop due to other operations that need to be performed. Any suggestions on how to achieve this?