const removeKeyword = (str, keyword) => str.split(/\r?\n/).filter(a => !a.includes(keyword)).join('\n'); let str = `123 test Здравствуй мир 123 123 test`; let keyword = 'Здравствуй мир'; str = removeKeyword(str, keyword); alert(str);