I want to be able to specify a list of characters/strings and find out how many occurrences from the list are in a given string.
const match = ['&', '|', '-', 'abc'];
const input = 'This & That | Or | THIS - Foo abc';
result should return 5
.
I can loop over the match and do indexOf
with a counter, but I'm wondering if there is some easier way with reduce
.
T =/= t
)