On 21 Oct 2021, at 12:47, TJ Luoma <[email protected] <mailto:[email protected]>> 
wrote:

> I'd like to be able to select a word, press a key, and have all instances of 
> that word be surrounded by {brackets}.... I wondered if there was a more 
> native way to accomplish this

#!/usr/bin/perl
while (<>) {
        s~myword~{$&}~ig;
        print;
} #END

The script
• reads the document line by line,
• surrounds all (~g) occurrences of "myword" (case-insensitive ~i) with curly 
brackets,
• prints the line.

Instructions:

Save the script in the Text Filters folder as ***.pl 
( Terminal:— cd; open Library/Application\ Support/BBedit/Text* )
Open the palette:  Menu: Window::Palettes::Text Filters
Select the script and set an optional keyboard shortcut
With your document frontmost, run the script
You can undo the action of the UNIX filter but…
… to see the result without altering the doc, run the script from the Scripts 
folder+palette

JD


-- 
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/99376642-B69E-4477-8090-519AC6668FCE%40gmail.com.

Reply via email to