I am editing and cleaning up a bunch of Calibre epub conversions and they're messy and full of trash code. Regex has been so helpful to find stuff that regular find and replace can't do efficiently.
I'm still pretty new to using Regex and I was wondering if it can help me find the following: Carriage returns / new lines that are
not new lines that end with a tag; then replace them with a blank 'space'.
Here's and example of uncorrected text:
Code:
<p class="p2">‘Professor!’
It
was
Vesuvius.
She sounded frightened. ‘Professor!’</p>
<p class="p2">Sara
looked to Robert.</p>
<p class="p1"><br/>‘What is it?’ Sara asked. Robert put his arm around her,
but she barely seemed to notice.</p>
...and ideally, I'd like the corrected file to look like this:
Code:
<p class="p2">‘Professor!’ It was Vesuvius. She sounded frightened. ‘Professor!’</p>
<p class="p2">Sara looked to Robert.</p>
<p class="p1"><br/>‘What is it?’ Sara asked. Robert put his arm around her, but she barely seemed to notice.</p>
Is this possible to do with regex? I've tried to figure it out but can't quite get it.