On 24 Oct 2021, at 05:55, Sonic Purity <sonicpur...@gmail.com> wrote:

>  ...i have a Big Picture question about whether perhaps my entire approach is 
> off base.

It is.  There are several languages that are good for text editing, and 
AppleScript is not among them. The conciseness of your desiderata below should 
be matched in your script.

> I want to preserve whatever markup exists as it is, to the right of my 
> delimiter #BARRIER#. To the left, in the actual title="", each </?em> should 
> be replaced with * and each </?strong> with **, and any other tags should be 
> removed.

 
BBEdit’s regular expressions are not much different from Perl’s, on which they 
are based.  Here is a simple Perl script that will do what you demand:

#!/usr/bin/perl
#Save in ../Text Filters/; run from palette
while (<>) { #read line by line
        my ($left, $right) = split "#BARRIER";
        $left =~ s~</?em>~\*~g; # s~x~y~g means substitute y for x globally
        $left =~ s~</?strong>~\*\*~g;
        $right =~ s~<[^>]+?>~~g;
        print $left . $right;
}
#END

With your document frontmost, try running the script above from the Text 
Filters palette after saving it as ***.pl in the proper folder; to open this 
run this line in Terminal:

cd; open Library/Application\ Support/BBedit/Text*

Have fun !

JD



-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" 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 bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/A825AFDC-6333-4D04-A4C2-47912B2E3EB4%40gmail.com.

Reply via email to