let text =`...for(10)='200' ...for(10)='800' ...for(10)='8003' `, word = `'800'`; let index = text.split(/[\r\n]+/).findIndex(str => str.includes(word)); alert(index);