const filterArray = (arr) => {
const re = /^(hand)\w*[syle]$/i;
return arr.filter((word) => re.test(word));
};
console.log(
filterArray([
"handOn",
"hands",
"hanDLes",
"Handcuffs",
"handmade",
"in-hands",
"HANDINGLY",
])
);
Y29uc3QgZmlsdGVyQXJyYXkgPSAoYXJyKSA9PiB7CiAgY29uc3QgcmUgPSAvXihoYW5kKVx3KltzeWxlXSQvaTsKICByZXR1cm4gYXJyLmZpbHRlcigod29yZCkgPT4gcmUudGVzdCh3b3JkKSk7Cn07Cgpjb25zb2xlLmxvZygKICBmaWx0ZXJBcnJheShbCiAgICAiaGFuZE9uIiwKICAgICJoYW5kcyIsCiAgICAiaGFuRExlcyIsCiAgICAiSGFuZGN1ZmZzIiwKICAgICJoYW5kbWFkZSIsCiAgICAiaW4taGFuZHMiLAogICAgIkhBTkRJTkdMWSIsCiAgXSkKKTsK