My post seems to have evaporated. If this turns out to be a duplicate, apologies!
Text->Remove Line Breaks appears to be a built in feature to do what you want. Basically, blocks of text with single line breaks become one long line. Two newlines separate paragraphs. View->Text Display->Soft Wrap Text will then give a pleasant visual layout without modifying the text. In my first post I suggested some regex patterns that on second glance do not seem to work. Once again, apologies! On Wednesday, May 31, 2023 at 11:27:27 AM UTC-5 Neil Faiman wrote: > > On May 30, 2023, at 10:47 PM, ProjectGuru <[email protected]> wrote: > > I'm looking for a GREP pattern that can delete the newlines that exist > ONLY after some text and NOT newline characters that exist between > paragraphs For example: > > ================================================= > > ORIGINAL TEXT: > > [Ms. Rowling] This is Ms. > Rowling, author > of the Harry Potter > collection. > And now onto the show. > > [intro music] > > [John] Hi everyone. > Welcome back to the > Harry Potter podcast. > I'm your co-host John Doe. > > DESIRED RESULT: > > [Ms. Rowling] This is Ms. Rowling, author of the Harry Potter collection. > And now onto the show. > > [intro music] > > [John] Hi everyone. Welcome back to the Harry Potter podcast. I'm your > co-host John Doe. > > ================================================= > > > This search pattern will do the trick. > > (?s)(?<=\S)\n(?=\S) > > > Command-F; put it in the Find: box, put a single space in the Replace: > box, check Grep, and click Replace All. > > Explanation: > > > - (?s) — the string being searched is the entire document, not > individual lines. > - (?<=\S)) — match the search string only when it is preceded by a > non-white-space character > - \n — the actual search string: a single newline > - (?=\S) — match the search string only when it is followed by a > non-white-space character > > > When I apply this to your original text, I get: > > [Ms. Rowling] This is Ms. Rowling, author of the Harry Potter collection. > And now onto the show. > > > [intro music] > > > [John] Hi everyone. Welcome back to the Harry Potter podcast. I'm your > co-host John Doe. > > Cheers, > Neil Faiman > > -- 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/6fd67435-bf29-40e8-8b8e-70b83ff325c8n%40googlegroups.com.
