On 06/03/2021, at 09:46, Howard <[email protected]> wrote:

Chris, what you wrote is very helpful.

To get the Grep results not enclosed in parentheses, I used the Replace pattern `\2` with this Search pattern:

\d*(\((\d+)\))\d*

but that resulted in these numbers:
10
16
10
11


Hey Howard,

That can't be right.  If you genuinely got the above result you need to show all your steps.

In BBEdit 12 and 13:

Source:

0000(10)0000
0(16)5000000
021(10)0000(11)

Find: `\d*(\((\d+)\))\d*`

Repl: `\2`

Result:

10
16
1011



The above would be better written this way:

Source:

0000(10)0000
0(16)5000000
021(10)0000(11)

Find: `\d*\((\d+)\)\d*`

Repl: `\1`

Result:

10
16
1011



To get the output you want add a space to `\1 `

You'll get:

10<space>
16<space>
10<space>11<space>

Follow that up by removing the trailing horizontal whitespace.

Find: `\h+$`

Repl: nothing



This becomes terribly tedious when you do it all by hand, so I wrote you an example Text Factory.

Install here:

~/Library/Application Support/BBEdit/Text Filters/Text Factories/

You have to run it from the Text > Apply Text Filter menu with the target document FRONTMOST.

Give it a keyboard shortcut for convenience in BBEdit's Menus & Shortcuts prefs.

Text Factories let you do quite a lot without learning how to write scripts.


--
Take Care,
Chris

--
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/3480DA58-0FBC-4F72-99EC-9C25C868986E%40gmail.com.

<<attachment: Howard.textfactory.zip>>



--
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/3480DA58-0FBC-4F72-99EC-9C25C868986E%40gmail.com.

Reply via email to