Reputation: 25
I have documents that contain carriage returns in the middle of sentences, like this:
Were there any connections? Or
was all of it
I have found a regex for finding these lines (Find: \w$
) and I can insert a full stop if I want (Replace: $0.
) but what do I do to insert a space and remove the carriage return/delete it instead so it becomes this:
Were there any connections? Or was all of it
I have a lot of these to replace so it would be helpful to get a replace command that takes care of all of them.
Is there a way to do this?
Upvotes: 2
Views: 3179
Reputation: 91415
(?<=\w)\R(?=\w)
A spaceExplanation:
(?<=\w) # positive lookbehind, make sure we have a word character before
\R # any kind of linebreak
(?=\w) # positive lookbahead, make sure we have a word character after
Screenshot (before):
Screenshot (after):
Upvotes: 3