Use grep replacements in a text factory?

50 views
Skip to first unread message

mwra

unread,
Aug 19, 2021, 3:28:51 PM8/19/21
to BBEdit Talk
I'm currently re-using grep find/replace via the Find dialog because I can't find a way to save and sequentially apply a number  of find/replace tasks (e.g. 4 or 5 discrete tasks) to a file.

It feels like a Text Factory is the place to do this but it's not to clear. It looks like the rather un-intuitively titled "Replace all" option is the way to go but to to easily re-use find/Replace parings you need to save those as a saved pattern (correct term?)

So, I *think* I've found all the pieces of the task but the documentation could surely be improved as nowhere I can find is this collection of steps hinted at in order to do the predictable task of using Find & Replace in a Text Factory.

I love this app but the manual could do with some review to check items hasn't hidden from search by use of feature terminology that someone new to the feature is unlikely to know.

In another context, I sit on the other end of this task, so I know it seems like a thankless documentation task. For the user of the documentation, the upside is considerable if terminology-obscured features are made more findable.

Thanks

Mark

ThePorgie

unread,
Aug 19, 2021, 4:24:51 PM8/19/21
to BBEdit Talk

Yeah, I'll give you the option in the Text Factory of "Replace All" is a bit odd rather than just something like "Find & Replace".
As for the rest. I have a few text factories that don't rely on any saved search pattern other than the string used in the text factory itself. The only time I don't get the desired result is when I don't/forget to check the grep box option in the lower right of the text factory window...that little bugger is easy to overlook. I can't really say I've had any problems with the manual.

Rich Siegel

unread,
Aug 19, 2021, 4:46:52 PM8/19/21
to BBEdit Talk
On 19 Aug 2021, at 15:18, mwra wrote:

> I'm currently re-using grep find/replace via the Find dialog because I
> can't find a way to save and sequentially apply a number of
> find/replace
> tasks (e.g. 4 or 5 discrete tasks) to a file.
> It feels like a Text Factory is the place to do this but it's not to
> clear.

That is the exact purpose of a Text Factory; namely, applying a sequence
of transformations to an input text. The input can either be a
specifically chosen file; or a folder; or some of each.

You can also apply a Text Factory to the contents or selection of the
active document by saving the factory into BBEdit's "Text Filters"
folder.

There's an entire section of Chapter 5 of the manual devoted to text
factories; and I'm sure Tech Support would be delighted to hear about
any errors or omissions there.

> It looks like the rather un-intuitively titled "Replace all" option is
> the
> way to go but to to easily re-use find/Replace parings you need to
> save
> those as a saved pattern (correct term?)

There's no need to save a pattern before using it in a text factory; you
can directly enter whatever you like in the fields for the "Replace All"
action; or copy and paste a pattern that you've worked out in the Find
window.

If you *already* have a saved pattern, that certainly saves a
copy/paste; but it is by no means required, necessary, or mandatory.

The "Replace All" text factory action performs the same operation as the
"Replace All" item on the Search menu and the "Replace All" button in
the Find window. Naming the text factory action anything else would be
counterintuitive.

R.

--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <https://www.barebones.com/>

Someday I'll look back on all this and laugh... until they sedate me.

Patrick Woolsey

unread,
Aug 19, 2021, 5:18:35 PM8/19/21
to bbe...@googlegroups.com
On 8/19/21 at 4:24 PM, thep...@gmail.com (ThePorgie) wrote:

>Yeah, I'll give you the option in the Text Factory of "Replace
>All" is a bit odd rather than just something like "Find & Replace".


For completeness :-) that's because the task performed by a text
factory 'Replace All' action is not an interactive search but a
batch operation exactly equivalent to the 'Replace All' menu
(and/or search window) command.


Regards

Patrick Woolsey
==
Bare Bones Software, Inc. <https://www.barebones.com/>

Reply all
Reply to author
Forward
0 new messages