I am trying to remove line breaks from a string that only begin with a specific character and am having trouble finding a solution. In my scenario I’m am trying to remove all line breaks where the line starts with a quotation mark. Heres an example:
Input:
const str = `
Test
"How" +
"Can" +
"I" +
Do This?
`;
Desired Result:
const desiredResult = `
Test
"How" + "Can" + "I"
Do This?
`;
I’ve only been able to find a way to remove all line breaks. Still unable to find a solution to only remove them if a conditional is met.