Barring additional unstated details, this pattern should work:

([a-z])([^\.])\n([a-z])

replacing with

\1\2 \3

Your current pattern is capturing the second-to-last character of the line
with ([a-z]), and then the last character in the line with [^\.] -- but
since *you didn't put that into a capture group*, it will be discarded.

You might consider using

([a-zA-Z0-9\s])([^\.])\n([a-zA-Z0-9\s])

or even just

([^\.])\n

replaced with

\1

(space at the end of that replace pattern).

I plumped up the search string to include capital letters and digits, you
may or may not want to do that. And I'm not sure if/why you really need the
first capture group at all -- is it important that the second-to-last
character and the next-line first character be a letter (or number or
space)?

But at the very least, putting a capture group around that character class
that excludes the period should give you what you need.

--Kerri

On Tue, Apr 25, 2023 at 6:15 AM 'Andy Nickless' via BBEdit Talk <
[email protected]> wrote:

> I want to find situations in a text document where there is no Full Stop
> at the end of the line, but there is (of course) a Line Break (suggesting
> the Line Break shouldn't be there).
> I can find what I want with this:
> ([a-z])[^\.]\n([a-z])
>
> Unfortunately, I can't work out how to then replace that with a simple
> Word Space.
> When I use \1 \2 it puts in a Word Space, but deletes the last letter off
> the \1 word and the first letter off \2
> Any help will be gratefully received!
> Andy
>
> --
> 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/39810fd8-e55d-40aa-aaf4-a5a12241a6a0n%40googlegroups.com
> <https://groups.google.com/d/msgid/bbedit/39810fd8-e55d-40aa-aaf4-a5a12241a6a0n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEmA4ubJwzZG172bHKVDcO24i91wPRrB_w_B1_%2BrS-mitRQ0MQ%40mail.gmail.com.

Reply via email to