I have been fighting with an expression for a while now. I have a document that formatted poorly when being pasted into InDesign, with every line ending in a carriage return. I am trying to find an expression that selects all carriage returns except those preceded by a period.
The image above illustrates what I am trying to select. I am unfortunately still fairly new to GREP, but have attempted a few expressions, none of which have wanted to cooperate.
[^\.]~b will successfully ignore the period, however, also results in it selecting the previous character:
If anyone may be able to provide assistance on the correct expression to use, it would be very much appreciated.
Use a negative look-behind instead: (?<!\.)~b
Keep in mind that there other punctuation marks that can end a paragraph, so this is not guaranteed not to fail. You might do better to find ([\.\?'")!\s])(~b) and replace with $1
Ahh, wonderful. The former worked perfectly.
I had tried a negative look-behind, but must not have formatted it properly. Thank you very much.