You can find the pos of the “He ” using the indexOf method and then get the position of the next line-break to remove that line using the substring method.
var someString = "Hello world,\n" +
"He like cats and dogs\n" +
"Bye bye";
var pos = someString.indexOf('He ');
var nextLineBreak = someString.indexOf('\n', pos);
var firstPart = someString.substring(0, pos);
var secondPart = someString.substring(nextLineBreak +1);
var finalString = firstPart + secondPart;
alert(finalString);
jsFiddle here : http://jsfiddle.net/zw2Gh/
1
solved Parse string using javascript [closed]