Hello @offshore9521 and All,
Humm…, @offshore9521, there are two separate problems with your regex !
From your INPUT text :
‘Colt?’
He turns to face her, and clears his throat.
Guilty sign. Very guilty. Probably has a guilty look on his face, but you
can’t tell, because he’s still wearing that helmet so you can’t see his
eyes.
Your regex (?<![\.\!\?])\r\n([a-z]) means :
If a \r\n sequence, followed with a letter (a through z), is not preceded by :
A dot
An exclamation mark
An interrogation mark
Then rewrite this letter
BTW, you can shorter this regex as (?<![.!?])\r\n([a-z])
But, the ’ character is not a character of the [.!?] list. Thus, this explains why your regex merges the lines 1 and 2
Now, I suppose that your true goal was : if a line is not a true sentence, then merge that line with the next one with a space character ? This lead to the follwing regex S/R :
FIND (?<![.!?’])\r\n(?=\w)
REPLACE \x20
So, any \r\n sequence is simply replaced with a space character
Notes :
As you see, I included the ’ character within the list of the forbidden chars, in the negative look-behind
I used \w, which is identical to the [\u\l\d_] class character, instead of [a-z] to not bother about case !
Remark :
Instead of
\r\n, I could have used the
\R syntax with matches
any kind of line endings (
\r,
\n or
\r\n ), but, because it is preceded by a
negative look-behind, we must insert
\r and
\n as
forbidden characters, as well !
FIND (?<![.!?’\r\n])\R(?=\w)
REPLACE \x20
Best Regards,
guy038
P.S. : As an exercice, try to understand why the following regex S/R does not work as expected :
FIND (?<![.!?’])\R(?=\w)
REPLACE \x20
To help you, don’t forget to click on the ¶ icon of the Toolbar !