I have a multi string:
My input:
var str = `The left lower lung thick parenchymal band as seen on prior
scan remains not hypermetabolic.The posterior left lung base tiny
density as seen on prior scan remains not significantly
hypermetabolic.`;
var element = 'The left lower lung thick parenchymal band as seen on prior scan remains not hypermetabolic';
var newElement = '<p1>The left lower lung thick parenchymal band as seen on prior scan remains not hypermetabolic</p1>';
How can I replace element
with newElement
in my original str
using a regex?
My attempt:
str.replace(/[^\\S ]/, ' ').replace(element, newElement)
When I try to replace using regex, I am not able to ignore the newlines and replace them at the same time.
Expected Result:
var str = `<p1>The left lower lung thick parenchymal band as seen on prior
scan remains not hypermetabolic</p1>.The posterior left lung base tiny
density as seen on prior scan remains not significantly
hypermetabolic.`;