With help of this thread I got the following piece of code, which find all occurrences of words with at least 3 letters:
arr = ["ab", "abcdef", "ab test"]
var AcceptedItems = arr.filter(function(item) {
return item.match(/[a-zA-Z]{3,}/);
});
In my case that should be abcdef
and test
.
But instead of the occurrences only, it gets me the whole entry of the array. So instead of just test
it gets me ab test
.
How can I get only the match (test
), not the whole array entry.