var str="good wood food cat bat hat";
console.log( str.match(/((g|w|f)ood)|((c|b|h)at)/g) );
Ответ:
[ 'good', 'wood', 'food', 'cat', 'bat', 'hat' ]
JavaScript test | #JavaScript
JA JavaScript test @js_test · 9.7K subscribers
var str="good wood food cat bat hat";
console.log( str.match(/((g|w|f)ood)|((c|b|h)at)/g) );