My json array:
[{"id":"7","name":"hello"},{"id":"7","name":"shan"},{"id":"7","name":"john"}
{"id":"7","name":"hello"}]
I want to get a new array that matches a regular expression on name
starting with a letter.
I am using regexp but i don't know how to implement it.
Here is my code:
var newitem=_.filter(result,item=>item.name='hello');
console.log(newitem);
But it returns with only strict match of name
.
Please help me to modify the above so that the result is a new array as described.
Expected output
when a usertype letter h
it shows only the row
{"id":"7","name":"hello"}