Hi Gavin, You could use a capture instead of a positive lookahead assertion and skip the trailing whitespaces.
Find: (\S)\h*\R(\S) Replace: \1 \2 HTH, Jean Jourdain On Wednesday, November 3, 2021 at 11:02:07 AM UTC+1 [email protected] wrote: > I have a lot of text that has been copied from a PDF, that I need to make > into text files for research purposes. When the text copied over, there was > a hard line return at the end of every sentences, and a blank space between > paragraphs. I need to the lines within the paragraph joined but the > paragraphs to remain separate and am looking for a regex to do that: > > *For example, the text looks like this:* > > *This is the 1st paragraph. * > *With a few lines that* > *need connected.* > > *This is another paragraph with* > *a blank line between* > *it and the previous paragraph.* > > *I want it to look like this:* > > *This is the 1st paragraph. With a few lines that need connected.* > > *This is another paragraph with a blank line between it and the previous > paragraph.* > > *The best that I have been able to come up with is this:* > > ([^\r\n])\R(?=[^\r\n]) > > *But that will also remove the last character of each line, so I get this:* > > *This is the 1st paragraph With a few lines tha need connected.* > > *This is another paragraph wit a blank line betwee it and the previous > paragraph.* > > Any suggestions about how to rewrite the above so that it does not remove > the final character? > > Gavin > > > -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "[email protected]" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/f4e4195b-9cbc-41f7-b0e9-c8b64a88dcefn%40googlegroups.com.
