> On May 24, 2023, at 8:16 AM, Mark Mayberry <[email protected]> wrote:
>
> BBEdit Text (Menu) >> Remove Line Breaks strips away the line breaks from
> within the paragraphs and leaves double line breaks at the end of each
> paragraph.
>
> How can I reproduce this specific action using Text Factory?
I can’t give you a direct answer, but many of the BBEdit Text menu commands
amount to commonly used grep replacements, packaged up in an easier-to-use
form, and you can always use a search-and-replace in a Text Factory.
As best I can tell, the following grep replacement will give you the Remove
Line Breaks behavior you are looking for.
Find: (?s)(?<!\n)\n(?!\n)
Replace:
(That is a single space as the Replace value.)
The (?s) tells the search string to match across multiple lines.
The (?<!\n) says to find only matches that are not preceded by a new-line.
The \n Is what the search actually matches — a new-line.
And the (?!\n) says to only find matches that are not followed by a new-line.
In short, the pattern finds all standalone new-lines (i.e., new-lines that are
neither preceded nor followed by another new-line) and replaces them with
spaces.
Given this input:
abc
def
ghi
jkl
mno
pqr
stu
v
w
x
It changes it to:
abc def ghi
jkl mno
pqr
stu v w x
Regards,
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/51E31324-9ED7-4E9D-8D5E-F5361041E0AC%40faiman.org.