Somnath Kharat
Somnath Kharat

Reputation: 3610

How to find a string from a line and delete the whole line

My Tooltip :

var ToolTip ="\nFilling :MLB\nInlay/onlay :BOL\nCaries :FIL";

the \n in the string makes the string to shift to new line:
I want than when i find string Filling a want to delete whole line ie \nFilling :MLB

I can find the string by using indexOf but how to delete the whole line

Upvotes: 0

Views: 81

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

Try

var ToolTip ="\nFilling :MLB\nInlay/onlay :BOL\nCaries :FIL";
ToolTip = ToolTip.replace(/\nFilling.*?\n/, '')

Upvotes: 3

Related Questions