1const multiSearchOr = (text, searchWords) => (
2 searchWords.some((el) => {
3 return text.match(new RegExp(el,"i"))
4 })
5)
6
7multiSearchOr("Chelsey Dietrich Engineer 2018-12-11 Hire", ["che", "hire"]) //returns true
8multiSearchOr("Chelsey Dietrich Engineer 2018-12-11 Hire", ["aaa", "hire"]) //returns true
9multiSearchOr("Chelsey Dietrich Engineer 2018-12-11 Hire", ["che", "zzzz"]) //returns true
10multiSearchOr("Chelsey Dietrich Engineer 2018-12-11 Hire", ["aaa", "1111"]) //returns false
11
1var str = 'hilly';
2var value = str.includes('hi'); //true, even though the word 'hi' isn't found
3var value = /\bhi\b/.test(str); //false - 'hi' appears but not as its own word
4