I need to return words from an string that are over a certain length and do this on 1 line of code.
Say I need to return all words over 2 chars in length...
So far I have...
const wordsOver2Chars = str => str.match(/\w+\s+(.{2,})/g);
console.log(
wordsOver2Chars('w gh w qwe regh aerguh eriygarew hw whio wh w')
);
This does not work.
str.match(/\w+\s+/g)
will return an array of words but I cannot figure out how to add in the length limiter as well.
Using split(' ').match(\regExp) errors.