JSFiddle - React, Tailwind, and code Playground
JavaScript
var str="hello how are you r u fineOr not .Why u r not fine.Please tell wats makes u notfiness";
var splitStr=str.split(" ");
splitStr.filter(function(word,index){
if(word.match(/fine/g)){
/*you may also store this in a data structure e.g. array*/
console.log(index);
return true;
}else{
return false;
}
});