Replacing "any character BUT a period then paragraph return" with space
We have text like this:
Start: {paragraph return}
line 1; {paragraph return}
line 2; {paragraph return}
ending line.{paragraph return}
That is, everything but the ending line could have a colon, semicolon, comma..., but ONLY the "ending line" has a period. This is the only period.
I want to end up with:
Start: line 1; line 2; ending line.{paragraph return}
I already have code that manipulates this for various reasons. I will add code that searches for "space ^p" (a space and then a paragraph return) and replaces with just "^p" (a paragraph return). I'll run this a few times, so that I should end up with "character ^p", each line ending with some type of character then an immediate paragraph return.
What I would like to implement is the following:
If the line does not end with a ".^p" but does end with a "^p", replace the "^p" with a space.
This removes the paragraph return from every line but those that end with a period and paragraph return.
I could "brute force" this by replacing all ";^p" with a space, all ",^p" with a space, ":^p" with a space.
But is there a more elegant way of doing this?
|