Here is my code and the problem is whether you search for "remember" or "member" it returns the result.As 'remember' has 'member' and I just want to search for exact matches. I should not return anything when I search for 'member'.
txt= `38
00:04:17.795 --> 00:04:23.551
Two previous cases
were open and shut.
39
00:04:23.601 --> 00:04:29.140
It was January 3, 1995,
my daughter's birthday.
40
00:04:29.140 --> 00:04:30.441
I remember.`
const searchedWord = 'member';
var res = txt
.toLowerCase()
.split('\n\n')
.filter((x) => {
return x.includes(searchedWord.toLowerCase());
});
console.log(res);